CSharp examples for Data Structure Algorithm:Factorial
Calculate Factorial Number with Iterative
using System;//from w ww . j a v a 2 s . c o m class Math { public static long Factorial(long number) { long factorial = 1; for(long i = number; i >= 1; i--) { factorial *= i; } return factorial; } } class Tester { public static void Main() { Console.WriteLine("4! = {0}", Math.Factorial(4)); } }