Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- int[] array = { 85, 2, 3, 12, -15, 0, 5, 87, 12, 45, 12, 789, -100, 1, 8, 56, 36, 86 };
- int temp;
- for (int i = 0; i < array.Length; i++)
- {
- Console.Write($"{array[i]}, ");
- }
- for (int i = 0; i < array.Length; i++)
- {
- for (int j = i + 1; j < array.Length; j++)
- {
- if (array[i] > array[j])
- {
- temp = array[i];
- array[i] = array[j];
- array[j] = temp;
- }
- }
- }
- Console.WriteLine();
- for (int i = 0; i < array.Length; i++)
- {
- Console.Write($"{array[i]}, ");
- }
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement