import java.util.*;
public class fact
{
public static void main (String [] args) {
System.out.println("Enter the no:" ) ;
Scanner s=new Scanner(System.in);
int a=s.nextInt();
int fact =1;
for(int i=0; i<=a; i++)
fact = fact*i;
}
System.out.println("factorial of" +a+ "number is" +fact) ;
}
}
output - Enter the no.
5
factorial of 5 number is 120
Comments
Post a Comment