PROGRAM TO CALCULATE FACTORIAL OF A NUMBER

//PROGRAM TO CALCULATE FACTORIAL OF A NUMBER
class Factorial
{
public static void main(String args[ ])
{
int i,s=1;
System.out.println(“Printing the factorial of 5: “);
for(i=5;i>=1;i–)
{
s=s*i;
}
System.out.println(“Factorial of 5 is: “+s);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *