Advertisement
deyanmalinov

05. Top Integers

Feb 15th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.*;
  4.  
  5. public class Main {
  6.         public static void main(String[] args) {
  7.             Scanner scan = new Scanner(System.in);
  8.             String [] line = scan.nextLine().split(" ");
  9.             int [] nums = new int[line.length];
  10.  
  11.             boolean isBig = false;
  12.             for (int i = 0; i < line.length; i++) {
  13.                 nums[i]=Integer.parseInt(line[i]);
  14.             }
  15.             for (int i = 0; i < nums.length; i++) {
  16.                 for (int j = i; j < nums.length; j++) {
  17.                     if (nums[i] < nums[j]){
  18.                         isBig = false;
  19.                         break;
  20.                     }else {
  21.                         isBig = true;
  22.                     }
  23.  
  24.                 }
  25.                 if (isBig == true){
  26.                     System.out.print(nums[i]+" ");
  27.                 }
  28.             }
  29.  
  30.  
  31.         }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement