Advertisement
grodek118

Remember these numbers

May 18th, 2022
670
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3.  
  4. import java.util.ArrayList;
  5. import java.util.Scanner;
  6.  
  7. public class Main {
  8.     public static void main(String[] args) {
  9.         Scanner scanner = new Scanner(System.in);
  10.         ArrayList<Integer> numbers = new ArrayList<>();
  11.  
  12.         while (true) {
  13.             int input = Integer.valueOf(scanner.nextLine());
  14.  
  15.             if (input == -1) {
  16.                 break;
  17.             }
  18.             numbers.add(input);
  19.         }
  20.  
  21.         for (int i = 0; i < numbers.size(); i++) {
  22.             System.out.println(numbers.get(i));
  23.         }
  24.        
  25.  
  26.     }
  27. }
Advertisement
RAW Paste Data Copied
Advertisement