stefan1919

Sort Array of Numbers

Sep 8th, 2015
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication6
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string input = Console.ReadLine();
  14.             string[] inputArray = input.Split(' ');
  15.             List<int> output = new List<int>();
  16.             for (int i = 0; i < inputArray.Length; i++)
  17.             {
  18.                 output.Add(int.Parse(inputArray[i]));
  19.             }
  20.             output.Sort();
  21.             output.Distinct().ToList().ForEach(i => Console.Write(i + " "));
  22.  
  23.             }
  24.         }
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment