Calculate the factorial of a number. From Fundamentals of Computer Programming with C# http://www.introprogramming.info/wp-content/uploads/2013/07/Books/CSharpEn/Fundamentals-of-Computer-Programming-with-CSharp-Nakov-eBook-v2013.pdf
int n = int.Parse(Console.ReadLine());
decimal factorial = 1;
while (true)
{
if (n <= 1)
{
break;
}
factorial *= n;
n--;
}
Console.WriteLine("n! = " + factorial);
// 5
// n! = 120