Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Task25
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int minValue = 0;
- int step = 1;
- int maxValueCountArray = 10;
- int maxValueCountArrayConvert = maxValueCountArray + step;
- int index;
- int[] array = new int[maxValueCountArrayConvert];
- for (int i = minValue; i < array.Length; i++)
- {
- array[i] = random.Next(minValue, maxValueCountArrayConvert);
- Console.Write(array[i] + " ");
- }
- for (int i = minValue; i < array.Length; i++)
- {
- index = i;
- for (int j = i; j < array.Length; j++)
- {
- if (array[j] < array[index])
- {
- index = j;
- }
- }
- if (array[index] == array[i])
- continue;
- int temp = array[i];
- array[i] = array[index];
- array[index] = temp;
- }
- Console.WriteLine("\nОтсортированный массив: ");
- for (int i = minValue; i < array.Length; i++)
- {
- Console.Write(array[i] + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement