Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class SortingArray
- {
- static void Main()
- {
- string input = Console.ReadLine();
- int[] numbers = input.Split(' ').Select(int.Parse).ToArray();
- for (int i = 0; i < numbers.Length - 1; i++)
- {
- int minValue = numbers[i];
- int index = i;
- for (int checker = i + 1; checker < numbers.Length; checker++)
- {
- if (numbers[checker] < minValue)
- {
- minValue = numbers[checker];
- index = checker;
- }
- if (checker == numbers.Length - 1)
- {
- int temp = numbers[index];
- numbers[index] = numbers[i];
- numbers[i] = temp;
- }
- }
- }
- foreach (var digit in numbers)
- {
- Console.WriteLine(digit);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement