This Is a Certified Answer

Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
Keep two variables, max and min and assign each of them as the first element of the array.
Traverse through the array and compare each element with max and min and update max and min accordingly: 
if(A[i] >max) max = A[i]
if(A[i] < min) min = A[i], where A is the array and i as an index.
This procedure would require 2 * n comparisions, where n is the length of the array.