1. Enter 10 person scores for highest score, sorted by points from highest to lowest
int[] arr =New int[Ten]; for(inti =0; I <Ten; i++)//arr.length=n{Console.Write ("Please enter section"+ (i +1) +"Personal Score:"); Arr[i]=int. Parse (Console.ReadLine ()); } for(inti =0; I <Ten; i++)//The array goes through the index, and each step takes the index and compares it with all the numbers back. { for(intj = i; J <9; J + +)//loop all the numbers from the J backwards { if(Arr[i] < Arr[j +1])//whatever is big, replace it, equal substitution { intm =0; M=Arr[i]; Arr[i]= Arr[j +1]; Arr[j+1] =m; }} Console.WriteLine (Arr[i]); } Console.WriteLine ("score up to"+ arr[0] +"points");
2. Enter 10 person score, remove the highest score of the lowest score, calculate the average score
Console.Write ("Please enter the number of people:"); intn =int. Parse (Console.ReadLine ()); int[] arr =New int[n]; intZuigao =0; intZuidi =999; intsum =0; for(inti =0; I < arr. Length; i++)//arr.length=n{Console.Write ("Please enter section"+ (i +1) +"height of individual:"); Arr[i]=int. Parse (Console.ReadLine ()); if(Zuigao <Arr[i]) {Zuigao=Arr[i]; } if(Zuidi >Arr[i]) {Zuidi=Arr[i]; } Sum+=Arr[i]; } DoublePinjun = (Sum-zuigao-zuidi)/(N-2); Console.WriteLine ("The highest is divided into:"+Zuigao); Console.WriteLine ("The lowest is divided into:"+Zuidi); Console.WriteLine ("The average is divided into:"+ Pinjun);
Enter 10 person score, get highest score, sort by score from high to low && remove highest score lowest score, calculate average score