Pages

Adsense responsive

Saturday, 16 March 2013

JAVA PROGRAM: TO CALCULATE FACTORIAL OF A NUMBER


CODING OF FACTORIAL BUTTON(jButton1)
        int num,i,fac = 1;
        num=Integer.parseInt(jTextField1.getText());
        for(i=num;i>0;i--)
        {
         fac=fac*i;
        }
        jTextField2.setText(" "+fac);

CODING OF CLEAR BUTTON(jButton2)
        jTextField1.setText(" ");
        jTextField2.setText(" ");
   

CODING OF EXIT BUTTON(jButton3)   
        System.exit(0);



CODING

RUNNING

We have used NetBeans IDE 7.3. To download it visit www.netbeans.org

For any query or suggestion please comment below...


No comments:

Post a Comment