using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int input = 10; //Factorial of the number to find
int fact = 1; //a temporary variable to store the intermediate computed values
//the computation
foreach (var number in Enumerable.Range(1, input).ToList()) fact *= number;
//display the result
Console.WriteLine("Factorial of {0} is {1}", input, fact);
Console.ReadKey();
}
}
}
Output
-------------
Factorial of 10 is 3628800