Medium csharp

Factorial of 22

Problem

Print factorial of 22.

Hints
  • Loop multiply

Your practice code

Ready — edit the code above and click Run.

Solution

using System;

class Program
{
    static void Main()
    {
        int n = 22;
        long f = 1;
        for (int i = 2; i <= n; i++) f *= i;
        Console.WriteLine(f);
    }
}

Try solving on your own first, then reveal the official answer.

Explanation

Use long for larger n.

Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details