Advertisement
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 straithselection
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] mas = new int[5];
- int minIdx, temp;
- for (int a = 0; a <mas.Length; a++)
- {
- mas[a] = Convert.ToInt32(Console.ReadLine().ToString());
- }
- for (int i = 0; i < mas.Length - 1; i++)
- {
- minIdx = i;
- for (int j = i + 1; j < mas.Length; j++)
- {
- if (mas[minIdx] > mas[j])
- {
- minIdx = j;
- }
- }
- temp = mas[i];
- mas[i] = mas[minIdx];
- mas[minIdx] = temp;
- }
- foreach (int el in mas)
- {
- Console.WriteLine(el);
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement