Thursday, 14 July 2011

Write a program to calculate factorial of number

class Fact
{
          public static void main(String[] arg)
          {
                   int fact=Integer.parseInt(arg[0]);
                   for(int i=fact-1;i>=1;i--)
                   {
                             fact=fact*i;
                   }
                   System.out.println("Fact="+fact);
          }
}

No comments:

Post a Comment

 

About The Author


I am a B.Tech Computer Science Student. I love Programming and blogging. I am Oracle certified Java Professional. Read More
Indian Blogger

Teachers Jobs

Footer 3

Twitter Facebook RSS YouTube Google
​

All Rights Reserved ©Sun Java Masters 2013