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 Sort
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rnd = new Random();
- int[] arr = new int [80];
- for (int i = 0; i < arr.Length; i++)
- {
- arr[i] = rnd.Next(700);
- }
- SelectionSort(arr);
- foreach (var item in arr)
- {
- Console.WriteLine(item);
- }
- Console.WriteLine();
- }
- static void SelectionSort(int[] arr)
- {
- for (int i = 0; i < arr.Length; i++)
- {
- for (int j = 0; j < arr.Length; j++)
- {
- if (arr[i] < arr[j])
- {
- var tmp = arr[i];
- arr[i] = arr[j];
- arr[j] = tmp;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement