TheBulgarianWolf

Top Integers

Oct 14th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics.CodeAnalysis;
  4. using System.Linq;
  5. using System.Numerics;
  6.  
  7. namespace SoftuniExercisesWithVariables
  8. {
  9.     class Program
  10.     {
  11.        
  12.  
  13.         static void Main(string[] args)
  14.         {
  15.  
  16.             Console.WriteLine("Enter your array here: ");
  17.             int[] array = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
  18.             for (int i = 0; i < array.Length-1; i++)
  19.             {
  20.                 bool bigger = true;
  21.                 for(int l = i + 1; l < array.Length; l++)
  22.                 {
  23.                     if(array[i] <= array[l])
  24.                     {
  25.                         bigger = false;
  26.                     }
  27.                 }
  28.                 if(bigger == true)
  29.                 {
  30.                     Console.Write(array[i] + " ");
  31.                 }
  32.                
  33.             }
  34.             Console.Write(array[array.Length - 1]);
  35.  
  36.  
  37.  
  38.  
  39.         }
  40.     }
  41. }
  42.  
Add Comment
Please, Sign In to add comment