Tuesday, 27 November 2012

Factorial Number

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

namespace factorial
{
class fact
{
static void Main(string[] args)
{
int fact = 1, n, i;
Console.WriteLine("\tFACTORIAL NUMBER");
Console.WriteLine("\t******************");
Console.WriteLine("Enter the Number");
n = int.Parse(Console.ReadLine());
if (n == 0)
{
Console.WriteLine("Can't Find Factorial");
}
else
{
for (i = 1; i <= n; i++)
{
fact = fact * i;
}
Console.WriteLine("Answer ={0}", fact);
}
}
}
}

No comments:

Post a Comment