stefan1919

Sorting Numbers

Aug 22nd, 2015
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 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 ConsoleApplication4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int index = 1;
  15.             int inputNumber = int.Parse(Console.ReadLine());
  16.             int[] array = new int[n];
  17.             array[0] = inputNumber;
  18.             while (index < n)
  19.             {
  20.                
  21.                 inputNumber = int.Parse(Console.ReadLine());
  22.                 array[index] = inputNumber;
  23.                 index++;
  24.             }
  25.  
  26.             Array.Sort<int>(array);
  27.             foreach (var item in array)
  28.             {
  29.                 Console.WriteLine(item);
  30.             }
  31.            
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment