using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
public class Class1
{
static long factorial(long num)
{
if(num<=1)
return 1;
else
return num*factorial(num-1);
}
static void Main(string[] args)
{
Console.WriteLine("enter the factorial Number::");
int x =int.Parse(Console.ReadLine());
Console.WriteLine("the factorial of "+ x +" is: {0}", factorial(x));
// return 0;
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
public class Class1
{
static long factorial(long num)
{
if(num<=1)
return 1;
else
return num*factorial(num-1);
}
static void Main(string[] args)
{
Console.WriteLine("enter the factorial Number::");
int x =int.Parse(Console.ReadLine());
Console.WriteLine("the factorial of "+ x +" is: {0}", factorial(x));
// return 0;
Console.ReadLine();
}
}
}
OUTPUT :
enter the factorial Number : : 5
The factorial of 5 is : 120
enter the factorial Number : : 5
The factorial of 5 is : 120
could u plz explain me flow of progm?
ReplyDeletesure
ReplyDelete