Add

Factorial Program in Java

12:11:00 PM Rohit Kumar Verma 0 Comments

Factorial Program in Java

Factorial is a product of all the positive integer less than or equal to the given value.

class PrintFactorial{
public static void main(String args[]){
 int a,factorial=1;
 int input=4;
 for(a=1;a<=input;a++){  
     factorial=factorial*a;  
 }  
 System.out.println("Factorial of "+input+" is: "+factorial);  
}
}  

0 comments: