Sunday, 23 September 2012

Factorial Of A Number

/********** Factorial Of A Number **********/

class Factorial
{
public static void main(String args[])
{
int a = 5;
int fact = a;
for(int i=a-1;i>=1;i--)
fact = fact * i;
System.out.println("Factorial : "+ fact);
}
}

/********** OUTPUT ***********
Factorial : 120 */

0 comments:

Post a Comment