Answer the question
In order to leave comments, you need to log in
How is the factorial of a number obtained in a C# loop?
Hello gentlemen! Help me understand how it turns out for the for loop to calculate the factorial of the entered number, I understand that this formula produces a factorial, but how this happens, I can’t visualize the order of calculation.
int n = Convert.ToInt32(Console.ReadLine());
int Foctarial = 1;
for (int i = 2; i <= n; i++)
{
Foctarial *= i;
}
Console.WriteLine(Foctarial);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question