factorial
// factorial
Console.WriteLine("Enter a number to get factorial");
int a = int.Parse(Console.ReadLine());
int i = 1;
int j = a;
for (; a != 0; a--)
{
i = i * a;
}
Console.WriteLine("factorial of " + j + " is " + i);
Console.ReadLine();
factorial
// factorial
Console.WriteLine("Enter a number to get factorial");
int a = int.Parse(Console.ReadLine());
for (; a != 0; a--)
{
Console.WriteLine(a);
}
Console.ReadLine();