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 Task_24_Repeat_In_Array
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[] array = new int []{ 45, 14, 22, 214, 5, 33, 22, 63, 79, 10, 144, 12 };
- int temp = 0;
- foreach (var item in array)
- {
- Console.Write($"{item} ");
- }
- for (int i = 0; i < array.Length; i++)
- for (int j = i + 1; j < array.Length; j++)
- if (array[i] > array[j])
- {
- temp = array[j];
- array[j] = array[i];
- array[i] = temp;
- }
- Console.WriteLine();
- foreach (var item in array)
- {
- Console.Write($"{item} ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment