Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Random random = new Random();
- int minRandomNumber = 0;
- int maxRandomNumber = 10;
- int[] array = new int[30];
- int tempItem;
- Console.WriteLine("Исходный массив:");
- for(int i = 0; i < array.Length; i++)
- {
- array[i] = random.Next(minRandomNumber, maxRandomNumber + 1);
- Console.Write(array[i] + " ");
- }
- Console.WriteLine("\n\nПосле сортировки пузырьком:");
- for (int i = 0; i < array.Length; i++)
- {
- for (int j = i + 1; j < array.Length; j++)
- {
- if (array[i] > array[j])
- {
- tempItem = array[i];
- array[i] = array[j];
- array[j] = tempItem;
- }
- }
- Console.Write(array[i] + " ");
- }
- Console.WriteLine("\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement