• Top Posts

    Calculate Factorial Number with Iterative using C# dotnet


     class factorial6  
       {  
         public static void Main()  
         {  
           Console.WriteLine("4! = {0}", Math.Factorial(4));  
           Console.ReadLine();  
         }  
       }  
       class Math  
       {  
         public static long Factorial(long number)  
         {  
           long factorial = 1;  
           for (long i = number; i >= 1; i--)  
           {  
             factorial *= i;  
           }  
           return factorial;  
         }  
       }  
    

    No comments

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728