IV
WRITE PROGRAMS
3. Write a program to accept the limit N and print the N factorial using for loop.
Answers
Answered by
2
Answer:
class FactorialExample{public static void main(String args[]){
int i,fact=1;
int number=5;//It is the number to calculate factorial.
for(i=1;i<=number;i++){
fact=fact*i;
}
System.out.println("Factorial of "+number+" is: "+fact);
Similar questions