Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class sample7
- {
- public static void main(){
- String input;
- int num1,num2;
- double average;
- input = JOptionPane.showInputDialog("First number");
- num1 = Integer.parseInt(input);
- input = JOptionPane.showInputDialog("Second Number");
- num2 = Integer.parseInt(input);
- average = (num1 + num2) / 2;
- JOptionPane.showMessageDialog(null,"The average of " + num1 + " and " + num2 + " is " +
- average);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement