import java.util.*;
public class DiffOfMaxMinValue {
public static void main(String args[]) {
int my_arr[] = { 12, 15, 2, 4, 9, 32, 70, 87, 98, 1, 5 };
int temp = 0;
int temp1 = 0;
int i, j;
for (i = 0; i < my_arr.length - 1; i++) {
if (my_arr[i] > my_arr[i + 1]) {
temp = my_arr[i + 1];
my_arr[i + 1] = my_arr[i];
my_arr[i] = temp;
}
}
// System.out.println("Maximum value in the given array is: " + my_arr[i]);
for (j = 0; j < my_arr.length - 1; j++) {
if (my_arr[j] < my_arr[j + 1]) {
temp1 = my_arr[j + 1];
my_arr[j + 1] = my_arr[j];
my_arr[j] = temp1;
}
}
// System.out.println("Minimum value in the given array is: " + my_arr[j]);
System.out.println("The difference of maximum and minimum value is : ");
System.out.println((temp1-temp));
}
}