Computer Science, asked by hannahsabu2005, 8 months ago

In question 7 answer , for what is the statement max=a(0)

Min = a (0) for?

What is the use of that?

Attachments:

Answers

Answered by puppireddycharithesh
2

To find the maximum and minimum of given array of numbers we should compare all the elements.

so to start there should be a number to compare with other elements and it is important that the number we choose to compare with is from the given array( because we want to find min and max of that particular array) .

so we initialise the min and max variables with the first number of the array and start comparing with other elements and we update the variables while iterating.

Similar questions