1)Write a program to find the difference between second maximum element and minimum element in an array.
If second maximum element does not exist, Assign second maximum element as 0.
Input:-
1)Read the size of an array.
2)Read the array elements.
output:-
o/p=second maximum element - minimum element in an array.
eg:-
5
4 9 6 3 2
second maximum element=6
minimum element=2
o/p= 6-2
o/p= 4.