Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class SortArray
- {
- static void Main()
- {
- int[] nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
- while (true)
- {
- bool check = false;
- for (int i = 0; i < nums.Length - 1; i++)
- {
- int temp = 0;
- if (nums[i] > nums[i + 1])
- {
- temp = nums[i + 1];
- nums[i + 1] = nums[i];
- nums[i] = temp;
- check = true;
- }
- }
- if (!check)
- {
- foreach (var digit in nums)
- {
- Console.Write("{0}, ", digit);
- }
- Console.WriteLine("\b\b ");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement