Hi! can someone help me to make this code littlest?
the next code (Array organizer) isnt that big, but im sure there is a way to make it littlest, can someone help me? https://code.sololearn.com/cUZPhJsw60sm/#cs namespace SoloLearn { class Program { static void Main(string[] args) { //this program order the numbers inside of an array and then prints it int[] arr = { 10, 1, 4, 6, 3, 5, 7, 2, 8, 9};//disordered numbers int min;//littlest number int may;//greatest number (dont ask why may...) int c = 0;//loop counter(i will use this variable for the exit mechanism) for (int x = 1; x < 9; x++)/*note that the array has 10 intergers but the loop starts with 1 and ends with 8, the following code will explain the why of this bounds (remember the zero index)*/ { if (arr[(x)-1]> arr[x] && arr[x] < arr[(x)+1]) { may = arr[(x) - 1]; min = arr[x]; // switching values position arr[x] = may; arr[(x) - 1] = min; } if (arr[(x)-1] < arr[x] && arr[x]>arr[(x)+1]) { may = arr[x]; min = arr[(x) + 1]; //switching values position arr[(x) + 1] = may; arr[x] = min; } if (arr[(x)-1]>arr[x] && arr[x] > arr[(x + 1)]) { min = arr[(x) + 1]; may = arr[(x) - 1]; //switching values position arr[(x) + 1] = may; arr[(x) - 1] = min; }/*the next lines of code insure that all the numbers are in the right position by running this loop the necessary times (Length of the array)*/ if (c == arr.Length)//loop exit