Powered by Blogger.

Simple java program for finding factorial of a number




/*Write a program to Find Factorial of Given no. */

class Factorial{
      public static void main(String args[]){
          int num = Integer.parseInt(args[0]);     
         //take argument as command line
          int result = 1;
          while(num>0){
                result = result * num;
                num--;
          }
          System.out.println("Factorial of Given no. is : "+result);
   }
}

Other Resources:
Factorial using for loop

Factorial using while loop
Share on Google Plus

About rajasekhar reddy

Author is a Tech savvy and Web Enthusiast by nature and really love to help users by providing how-to posts and tech tutorials. He is a founder and author of technolamp.co.in and programming9.com. YouTube Channel to SUBSCRIBE:
    https://www.youtube.com/user/nvrajasekhar
Available: info@programming9.com
Post a Comment