-
Language
Java using JOptionPane
-
Description
Sum of two numbers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
import javax.swing.JOptionPane;
public class SumOfTwoNumbers {
public static void main (String[] args) {
double a, b, sum;
a = Double.parseDouble(JOptionPane.showInputDialog("Enter the value of a"));
b = Double.parseDouble(JOptionPane.showInputDialog("Enter the value of b"));
sum=a+b;
JOptionPane.showMessageDialog(null,
"Value of sum: " + sum);
}
}
public class SumOfTwoNumbers {
public static void main (String[] args) {
double a, b, sum;
a = Double.parseDouble(JOptionPane.showInputDialog("Enter the value of a"));
b = Double.parseDouble(JOptionPane.showInputDialog("Enter the value of b"));
sum=a+b;
JOptionPane.showMessageDialog(null,
"Value of sum: " + sum);
}
}