import java.util.*;
class Factorial{
public static void main(String args[]){
Scanner scan=new Scanner(System.in);
int i,fact=1;
System.out.println("enter number to find factorial");
int number=scan.nextInt();
for(i=1;i<=number;i++){
fact=fact*i;
}
System.out.println("Factorial of "+number+" is: "+fact);
}
}
class Factorial{
public static void main(String args[]){
Scanner scan=new Scanner(System.in);
int i,fact=1;
System.out.println("enter number to find factorial");
int number=scan.nextInt();
for(i=1;i<=number;i++){
fact=fact*i;
}
System.out.println("Factorial of "+number+" is: "+fact);
}
}
No comments:
Post a Comment