Menu Close

Find the biggest even number

Write a program to find the biggest even number from the given input.
Input: Positive numbers
Output: Display the largest even number.

tot=int(input("Enter the N number: "))

list1=[]

for i in range(tot):
  d=int(input())
  list1.append(d)
list1.sort()
list2=[]

for i in range(tot):
  if list1[i]%2==0:
    list2.append(list1[i])

print("Largest even number: {}".format(list2[len(list2)-1]))




'''
Input:
Enter the N number: 5

Output:
    199
    191
    991
    2
    551
    Largest even number: 2
'''

More Codes to Fcuk

Explore