Write a program to find the range of the elements in the array. Range of an array is the difference between the maximum and minimum element in an array,
Answers
Answered by
1
Answer:
public class Main
{
public static void main(String[] args) {
int[] arr = {9,8,7,6,5,4,3,2,1,1,124};
java.util.Arrays.sort(arr);
int max = arr[arr.length-1];
int min = arr[0];
int range = max-min;
System.out.println("The range of the array is " + range);
}
}
Explanation:
Similar questions
India Languages,
6 months ago
English,
6 months ago
Math,
6 months ago
Math,
1 year ago
Computer Science,
1 year ago
Biology,
1 year ago