Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. public class sample7
  3. {
  4. public static void main(){
  5. String input;
  6. int num1,num2;
  7. double average;
  8.  
  9. input = JOptionPane.showInputDialog("First number");
  10. num1 = Integer.parseInt(input);
  11. input = JOptionPane.showInputDialog("Second Number");
  12. num2 = Integer.parseInt(input);
  13. average = (num1 + num2) / 2;
  14.  
  15. JOptionPane.showMessageDialog(null,"The average of " + num1 + " and " + num2 + " is " +
  16. average);
  17.  
  18.  
  19.  
  20.  
  21.  
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement