class FactorialExampleProg{
public static void main(String args[]){
int j,f=1;
int num=5;//Number for which we want to calculate factorial
for(j=1;j<=num;j++){
f=f*j;
}
System.out.println("Factorial of "+num+" is: "+f);
}
}
public static void main(String args[]){
int j,f=1;
int num=5;//Number for which we want to calculate factorial
for(j=1;j<=num;j++){
f=f*j;
}
System.out.println("Factorial of "+num+" is: "+f);
}
}
No comments:
Post a Comment