danail2003 4 Точки

## Factorial Division

Здравейте, дава ми 30/100, ако може някой да ми помогне.

## 1.Factorial Division

Read two integer numbers. Calculate factorial of each number. Divide the first result by the second and print the division formatted to the second decimal point.

### Examples

 Input Output Input Output 5 2 60.00 6 2 360.00

using System;

namespace Factorial_Division
{
class Program
{
static void Main(string[] args)
{
DiviseNumbers(factorialNumber, divider);
}

static void DiviseNumbers(long factorialNumber, long divider)
{
long multiply = 1;

for (int i = 2; i <= factorialNumber; i++)
{
multiply *= i;
}

long result = multiply / divider;
Console.WriteLine(\$"{result:f2}");
}
}
}

Тагове:
0
mark79 585 Точки

Здравей,

ето ти примерно решение, предполагам можеш да видиш къде е разликата

``````        static long DiviseNumbers(int n)
{
if (n == 0)
return 1;
else
return (n * DiviseNumbers(n - 1));
}

static void Main(string[] args)
{

double result = (double)DiviseNumbers(factorialNumber) / DiviseNumbers(divider);
Console.WriteLine(\$"{result:f2}");
}``````

Поздрави :)

PS -> Ако рекурсията не е ясна, може и така

``````        static long DiviseNumbers(int factorialNumber)
{
long multiply = 1;
for (int i = 2; i <= factorialNumber; i++)
{
multiply *= i;
}
return multiply;
}``````

0
25/08/2019 22:48:44
Ronn91 -1 Точки

I am so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that’s at the other blogs.