When the input is 25
the expected output is 15511210043330985984000000
and not 1.551121e+25
. The parsing though is solved by Decimal.Parse(factorial.ToString(), System.Globalization.NumberStyles.Float)
.
I cannot get to calcuate for bigger numbers like 95.
using System;
namespace bigNumber
{
class Program
{
static void Main(string[] args)
{
int number = Convert.ToInt32(Console.ReadLine());
long factorial = 1;
for (int i = number; i > 0; i--)
{
factorial = factorial * i;
}
Console.WriteLine(factorial);
}
}
}