Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Selection sort c#
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); int[] arr = {5, 4, 10, 7, 8, 1}; for(int j = 0; j< arr.Length ; j++) { int minIndex = j; int minValue = arr[minIndex]; for(int i = j+1; i< arr.Length ; i++) { if(arr[i] < minValue) { minIndex = i; minValue = arr[i]; } } if(minIndex != j) { int temp = arr[j]; arr[j] = arr[minIndex]; arr[minIndex] = temp; } } foreach(int a in arr) Console.WriteLine(a); //Console.WriteLine("minvalue " + minValue); } } }
run
|
edit
|
history
|
help
0
matching parenthesis
Date Example
sum 2
C# simple fib solution
1.3 Basics: interfaces
C#: Strings / Char Test
CommandForce3
Task 1_4
Reed Solomon Demo
Using System.Reflection to find Property Name and Value of any Generic Class