An Addition program in Java Programing Language.
Write this program in  Java environment and run it.


import javax.swing.JOptionPane;


public class Addition {

public static void main(String[] args) {
String firstnumber;
String secondnumber;
int number1;
int number2;
int sum;

firstnumber=JOptionPane.showInputDialog("Enter first number");
secondnumber=JOptionPane.showInputDialog("Enter second number");
number1 = Integer.parseInt( firstnumber );
number2 = Integer.parseInt(secondnumber);
sum = number1 + number2;
JOptionPane.showMessageDialog(null , "The sum is "+sum, "Results", JOptionPane.PLAIN_MESSAGE );
System.exit(0);
}

}

Posted by Unknown On Monday, May 20, 2013 No comments

0 comments:

Post a Comment

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Like us

    as

    Contact Form

    Name

    Email *

    Message *