T.V. NAGARAJU TECHNICAL SOLUTIONS
Pages
Home
Online Courses
Tutorials
Operating Systems
C -Excercises
Python Excercises
JAVA Exercises
Placement Papers
Lab Programs
Python Programs
Program to Find 2 Elements in the Array such that Difference between them is Largest
a=list(map(int,input().split()))
diff=a[1]-a[0]
minele=a[0]
for i in range(1,len(a)):
if a[i]-minele>diff:
diff=a[i]-minele
if a[i]<minele:
minele=a[i]
print(diff)
Input
1 5 9 3 4 8
Output
8
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment