Sunday, 1 September 2013

factorial of number ?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace factorial
{
    class Program
    {
       static void Main(string[] args)
       {
           int num,i,fact=1;
           Console.WriteLine("enter the number ");
           num = Int32.Parse(Console.ReadLine());
           for (i = 1; i <=num; i++)
           {
               fact = fact * i;
           }

           Console.WriteLine("factorial of number are " + fact);
           Console.WriteLine();
       }
    }
}

No comments:

Post a Comment