Please code using C#
Complete the two methods, highest() and lowest().
Examples:
The call highest(3) with user inputs of [5, 60, 2] will return the value of 60
The call lowest(3) with user inputs of [20, 10, 5] will return the value of 5
using System;
class HelloWorld {
static void Main() {
int []arr={5, 60, 2};
Console.WriteLine(highest(arr));
Console.WriteLine(lowest(arr));
}
static double highest(int [] arr){
int max=arr[0];
for(int i=1;i<arr.Length;i++){
if(max<arr[i])
max=arr[i];
}
return max;
}
static double lowest(int [] arr){
int min=arr[0];
for(int i=1;i<arr.Length;i++){
if(min>arr[i])
min=arr[i];
}
return min;
}
}
NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME IT IS VERY IMP FOR ME
Get Answers For Free
Most questions answered within 1 hours.