Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class pears {
- public static void main(String[] args) {
- int total = 0;
- String x = JOptionPane.showInputDialog("enter nums please");
- String[] split = x.split("\\s+");
- for (int i = 0; i < split.length; i++){
- total += Integer.parseInt(split[i]);
- }
- JOptionPane.showMessageDialog(null, "the sum is" + total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement