import java.util.Scanner;
public class Fac{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
System.out.println("enter the num for which u want the factorial");
int num = in.nextInt();
for(int i=num-1; i>0; i-- ){
num = num*i;
}
System.out.println(num);
}
}
No comments:
Post a Comment