/********** 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 */
Labels: Core Java
Subscribe to:
Post Comments (Atom)
Post a Comment