package Rahul;
import java.util.Scanner;
public class Fact {
static int fact(int num)
{
if(num==0)
return 1;
else
return(num*fact(num-1));
}
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter number:");
int n=sc.nextInt();
System.out.print("Factorial of "+n+"="+Sec.fact(n));
}
}
import java.util.Scanner;
public class Fact {
static int fact(int num)
{
if(num==0)
return 1;
else
return(num*fact(num-1));
}
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter number:");
int n=sc.nextInt();
System.out.print("Factorial of "+n+"="+Sec.fact(n));
}
}
No comments:
Post a Comment