Skip to content

Commit a2ac607

Browse files
authored
Add files via upload
1 parent c1e0c53 commit a2ac607

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

array2.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#Python3 program to find maximum
2+
#in arr[] of size n
3+
4+
def largest(arr,n):
5+
#initialize maximum element
6+
max = arr[0]
7+
#Traverse array elements from second and compare every element with current max
8+
9+
for i in range(1,n):
10+
if arr[i] >max:
11+
max = arr[i]
12+
return max
13+
14+
15+
#Driver Code
16+
arr = [10,324,45,90,9808]
17+
n = len(arr)
18+
Ans = largest(arr,n)
19+
print('Largest in given array is',Ans)
20+

0 commit comments

Comments
 (0)