Advertisement
A_Marinov

Untitled

Oct 6th, 2020
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. package Excirsice;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class TopIntegers_05 {
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in);
  8.         String[] input = scan.nextLine().split("\\s+");
  9.  
  10.         int[] numbers = new int[input.length];
  11.  
  12.         for (int i = 0; i < input.length; i++) {
  13.             numbers[i] = Integer.parseInt(input[i]);
  14.         }
  15.  
  16.         for (int i = 0; i < numbers.length - 1; i++) {
  17.             if (numbers[i] > numbers[i + 1]) {
  18.                 System.out.print(numbers[i]+" ");
  19.             }
  20.         }
  21.         System.out.print(numbers[numbers.length - 1]);
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement