Factorial program How to use static function in C#

using System;
namespace static_factorial
{
    class Program
    {
      

        static void factorial()
        {
            {
                int num1;
                int fact = 1;
                Console.WriteLine("enter your number");
                num1 = Convert.ToInt32(Console.ReadLine());
                for (int i = 1; i < num1; i++)
                {
                    fact =fact*i;
                 
                }
                    Console.WriteLine("your ans is "+ fact);

                   }
          
        }


        static void Main(string[] args)
        {
            Console.WriteLine("here is your static code");
            Program.factorial();

            Console.ReadLine();
        }
    }
}

1 comment:

  1. It is a wrong code. you are nothing but a poor skilled programmer.

    ReplyDelete