SHARE
TWEET

Untitled

a guest Jun 26th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace TopInteger
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int[] numbers = Console.ReadLine()
  11.                 .Split(" ")
  12.                 .Select(int.Parse)
  13.                 .ToArray();
  14.  
  15.             for (int i = 0; i < numbers.Length - 1; i++)
  16.             {
  17.                 int currentNumber = numbers[i];
  18.                 bool isTopInteger = true;
  19.  
  20.                 for (int j = i + 1; j < numbers.Length; j++)
  21.                 {
  22.                     int otherNumber = numbers[j];
  23.  
  24.                     if (currentNumber <= otherNumber)
  25.                     {
  26.                         isTopInteger = false;
  27.                         break;
  28.                     }
  29.                 }
  30.                 if (isTopInteger == true)
  31.                 {
  32.                     Console.Write(currentNumber + " ");
  33.                 }
  34.             }
  35.             Console.WriteLine(numbers[numbers.Length - 1]);
  36.         }
  37.     }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top