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