Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _03InsertSort
- {
- class Program
- {
- static void Main()
- {
- int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
- for (int i = 1; i < arr.Length; i++)
- {
- for (int j = i; j > 0; j--)
- {
- if (arr[j - 1] > arr[j])
- {
- int temp = arr[j - 1];
- arr[j - 1] = arr[j];
- arr[j] = temp;
- }
- }
- }
- for (int i = 0; i < arr.Length; i++)
- {
- Console.Write(arr[i]+ " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement