Advertisement
Guest User

Untitled

a guest
Mar 9th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. import java.lang.*;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.    
  6.     public static void main(String a[]) {
  7.        
  8.         Scanner reader = new Scanner(System.in);
  9.         int numero = 0;
  10.         int somma = 0;
  11.        
  12.         do {
  13.             somma += numero;
  14.             System.out.print("Inserire un numero: ");
  15.             numero = reader.nextInt();
  16.         } while(numero != 0);
  17.        
  18.         System.out.println("Somma numeri inseriti: " + somma);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement