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 Home6._1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] array = new int[30];
- int stepSort = 1;
- int tempSort;
- Random random = new Random();
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = random.Next(10, 99);
- Console.Write(array[i] + " ");
- }
- Console.WriteLine();
- while (stepSort != 0)
- {
- stepSort = 0;
- for (int i = 0; i < array.Length-1; i++)
- {
- if (array[i] < array[i + 1])
- {
- tempSort = array[i];
- array[i] = array[i + 1];
- array[i + 1] = tempSort;
- stepSort++;
- }
- }
- }
- for (int i = 0; i < array.Length; i++)
- {
- Console.Write(array[i] + " ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement