Program to find Factorial of number

/*  Program to find Factorial of number */

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

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|