Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class SUBTRACTION {
- public static void main(String[] args) {
- String string1 = JOptionPane.showInputDialog("Enter First NUmber");
- String string2 = JOptionPane.showInputDialog("Enter Second NUmber");
- String string3 = JOptionPane.showInputDialog("Enter Third NUmber");
- String string4 = JOptionPane.showInputDialog("Enter Fourth NUmber");
- String string5 = JOptionPane.showInputDialog("Enter Fifth NUmber");
- String string6 = JOptionPane.showInputDialog("Enter Sixth NUmber");
- int num1 = Integer.parseInt(string1);
- int num2 = Integer.parseInt(string2);
- int num3 = Integer.parseInt(string3);
- float addnum1 = (num1+num2+num3);
- String addstring = "Addition of the first three input is: " + addnum1;
- int num4 = Integer.parseInt(string4);
- int num5 = Integer.parseInt(string5);
- int num6 = Integer.parseInt(string6);
- float addnum2 = (num4+num5+num6);
- String addstring1 = "Addition of the second three input is: " + addnum2;
- float subnum = addnum1 - addnum2;
- String substring = "Subtraction of " + addnum2 + " from " + addnum1 + " is: " + subnum;
- JOptionPane.showMessageDialog(null, addstring);
- JOptionPane.showMessageDialog(null, addstring1);
- JOptionPane.showMessageDialog(null, substring);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement