Advertisement
Razhagal

Sorting Numbers

Mar 31st, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 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. class SortingNumbers
  8. {
  9.     static int[] FillTheArray(int inputCount)
  10.     {
  11.         int[] array = new int[inputCount];
  12.  
  13.         for (int i = 0; i < array.Length; i++)
  14.         {
  15.             array[i] = int.Parse(Console.ReadLine());
  16.         }
  17.  
  18.         Array.Sort(array);
  19.         return array;
  20.     }
  21.  
  22.     static void Main()
  23.     {
  24.         int numbersCount = int.Parse(Console.ReadLine());
  25.         int[] numbersArray = FillTheArray(numbersCount);
  26.  
  27.         Console.WriteLine();
  28.  
  29.         foreach (var number in numbersArray)
  30.         {
  31.             Console.WriteLine(number);
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement