Guest User

Untitled

a guest
Oct 14th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Sumator {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.         System.out.println("Wprowadź liczby jakie chcesz, zakończ zerem, program zsumuje wszyskite liczby i wyświetli wynik");
  8.        
  9.         //inicjuję scanner
  10.        
  11.         Scanner load = new Scanner(System.in);
  12.        
  13.         int numbers = Integer.MAX_VALUE;
  14.         int n = Integer.MAX_VALUE;
  15.         int i;
  16.         int result = 0;
  17.  
  18.         for (i=1; i<=n; i++){
  19.         numbers = load.nextInt();
  20.        
  21.         result+=numbers[i];
  22.            
  23.             if (numbers==0);
  24.             break;
  25.            
  26.             System.out.println("Wynik to: " + result);
  27.            
  28.            
  29. }}}
Advertisement
Add Comment
Please, Sign In to add comment