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);

   }

}

0 komentar:

Post a Comment

Related Posts with Thumbnails
GiF Pictures, Images and Photos