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
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
English,
4 months ago
English,
4 months ago
Hindi,
4 months ago
English,
9 months ago
Physics,
9 months ago
Social Sciences,
1 year ago
Computer Science,
1 year ago