Q.8: Factorial of Given number using Recursion.class Factorial
{
long fact(int n)
{
if(n==0||n==1)
return 1;
else
return n*fact(n-1);
}
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
Factorial f=new Factorial();
long fact=f.fact(n);
System.out.println("Factorial of given Num is: "+fact);
}
}
thanq superr......
ReplyDeleteThank you So much for your Appreciation Shravan
Deleteexcellent boss
ReplyDeleteThank you So much for your Appreciation rajesh
Deletebeautiful concept
ReplyDeleteThank you So much for your Appreciation Mohan
Deletevidu dhammunod ra bujji
ReplyDelete