
The factorial of an integer m is the product of conrective integers from 1 to m. that is factorial m=m!=m(m-1)........*1
write a program that computer and prints a table of factorial for any given m

Hi Friend,
Try the following code:
import java.util.*;
class Factorial{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter value of m: ");
int m=input.nextInt();
long num=m;
for(int i=m;i>1;i--){
num=num*(i-1);
}
System.out.println(num);
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.