Math, asked by sanvitharaavi, 6 months ago

write a c function that takes an array of float values and prints out the differences of
minimum and maximum values in array

Attachments:

Answers

Answered by rishabhrajdubey5
0

Answer:

And the function declaration becomes: struct pair getMinMax(int arr[], int n) where arr[] is the array of size n whose minimum and maximum are needed.

METHOD 1 (Simple Linear Search)

Initialize values of min and max as minimum and maximum of the first two elements respectively. Starting from 3rd, compare each element with max and min, and change max and min accordingly (i.e., if the element is smaller than min then change min, else if the element is greater than max then change max, else ignore the element)

Similar questions