Write a program to find out the factorial of the given no.

class Factorial
 {
   public static void main(String args[])
     {
       int i,num;
       num=Integer.parseInt(System.console().readLine("Enter the number="));
       int fact=1;
       for(i=1;i<=num;i++)
         {
           fact=fact*i;
          
         }
      
       System.out.println("factorial of Number="+fact);
     }
 }

No comments:

Post a Comment