How to find maximum and minimum value from an array

 Output