find the max value in the array code example
Example 1: Write a function that returns the largest element in a list
def return_largest_element(array):
largest = 0
for x in range(0, len(array)):
if(array[x] > largest):
largest = array[x]
return largest
Example 2: max element in array
int max;
max=INT_MIN;
for(int i=0;i<ar.length();i++){
if(ar[i]>max){
max=ar[i];
}