using System;
class abc
{
int num, fact = 1;
public void facto()
{
Console.WriteLine("enter the number to find its factorial");
num = int.Parse(Console.ReadLine());
Console.WriteLine("factorial is : ");
for (int i = 1; i <= num; i++)
{
fact = fact * i;
}
Console.WriteLine(fact);
Console.ReadKey();
}
}
class factorial
{
public static void Main(string[] args)
{
abc a = new abc();
a.facto();
}
}
output
class abc
{
int num, fact = 1;
public void facto()
{
Console.WriteLine("enter the number to find its factorial");
num = int.Parse(Console.ReadLine());
Console.WriteLine("factorial is : ");
for (int i = 1; i <= num; i++)
{
fact = fact * i;
}
Console.WriteLine(fact);
Console.ReadKey();
}
}
class factorial
{
public static void Main(string[] args)
{
abc a = new abc();
a.facto();
}
}
output
No comments :
Post a Comment