# Find Largest Element of an Array using Function
# python function to find maximum
# in arr[] of size n
def largest(arr,n):
# Initialize maximum element
max = arr[0]
# Traverse array elements from second
# and compare every element with
# current max
for i in range(1, n):
if arr[i] > max:
max = arr[i]
return max
# Drive Code
arr =[i for i in range(100)]
n = input(" Enter total number of elements(1 to 100):")
n=int(n);
for i in range(n):
arr[i]= input(" Enter Number for index {0} ".format(int(i)));
Ans = largest(arr,n)
print ("Largest in given array is",Ans)
# python function to find maximum
# in arr[] of size n
def largest(arr,n):
# Initialize maximum element
max = arr[0]
# Traverse array elements from second
# and compare every element with
# current max
for i in range(1, n):
if arr[i] > max:
max = arr[i]
return max
# Drive Code
arr =[i for i in range(100)]
n = input(" Enter total number of elements(1 to 100):")
n=int(n);
for i in range(n):
arr[i]= input(" Enter Number for index {0} ".format(int(i)));
Ans = largest(arr,n)
print ("Largest in given array is",Ans)