Computer Science, asked by ayaan4461, 1 year ago

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 samarthkrv
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