• Top Posts

    Create and exercise a factorial method that has no error checks at all. using C# dotnet


     class afctorial4  
       {  
         public static void Main(string[] args)  
         {  
           for (int i = 6; i > -6; i--)  
           {  
             Console.WriteLine("i = {0}, factorial = {1}", i, MyMathFunctions.Factorial(i));  
             Console.ReadLine();  
           }  
         }  
       }  
       public static class MyMathFunctions1  
       {  
         public static double Factorial(double value)  
         {  
           double factorial = 1.0;  
           do  
           {  
             factorial *= value;  
             value -= 1.0;  
           } while (value > 1);  
           return factorial;  
         }  
       }  
    

    No comments

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728