How to calculate a max value in a array without the built in functions.
314 views (last 30 days)
More Answers (2)
Shivani Dixit on 1 Jun 2021
You can use for loop or while loop for finding out the maximum or minimum element in the array without using any built-in functions.
Finding out maximum value in an array using for loop is shown below:
Time = [1,6,3,6,8,12,1];
ans = Time(1); % Initially take maximum element as first element and after iterating over the loop we will get final answer
% The variable 'ans' would store the final maximum value