Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Сортировка_чисел
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[] array = new int[20];
- int temp = 0;
- Random random = new Random();
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = random.Next(0, 100);
- Console.Write(array[i] + " ");
- }
- Console.WriteLine();
- for (int i = 0; i < array.Length; i++)
- {
- for (int j = 0; j < array.Length - 1; j++)
- {
- if (array[j] > array[j + 1])
- {
- temp = array[j];
- array[j] = array[j + 1];
- array[j + 1] = temp;
- }
- }
- }
- for (int i = 0; i < array.Length; i++)
- {
- Console.Write(array[i] + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement