Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int[] arr = new int [8] {1,3,2,15,30,20,10,4};
- int n = 8;
- int i, j, k;
- for (i = 0; i < n; i++)
- {
- k = arr[i];
- j=i-1;
- while (j >= 0 && arr[j] > k)
- {
- arr [j+1] = arr [j];
- j=j-1;
- }
- arr [j+1] = k;
- }
- Console.Write("Výsledek: ");
- foreach (int cislo in arr)
- {
- Console.Write(cislo+", ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment