Sunday, August 12, 2012

Java program to print Factorial of a number, as Programmers wish


class factorial
{
int f;
factorial()
           {
f=1;
           }
void disp()
{
for(int i=1;i<5;i++)
     {
f=f*i;
System.out.println(f);
      }
}
public static void main(String s[])
             {
factorial f= new factorial();
f.disp();
             }
}

0 comments:

Post a Comment