jfcmacro

Sumar

Feb 21st, 2020
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Sumar {
  4.  
  5.     public static void main(String[] args) {
  6.     Scanner scan = new Scanner(System.in);
  7.  
  8.     int suma = 0;
  9.     while (scan.hasNextInt()) {
  10.         int num = scan.nextInt();
  11.         suma += num;
  12.     }
  13.     System.out.println("Suma: " + suma);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment