a = []
while 1:
d = int(input())
if d == 0:
break
a.append(d)
n = int(input("Введите n: "))
if a.index(n) == 0:
print(a[1])
elif a[a.index(n) - 1] < a[a.index(n) + 1]:
print(a[a.index(n) - 1])
else:
print(a[a.index(n) + 1])
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
a = []
while 1:
d = int(input())
if d == 0:
break
a.append(d)
n = int(input("Введите n: "))
if a.index(n) == 0:
print(a[1])
elif a[a.index(n) - 1] < a[a.index(n) + 1]:
print(a[a.index(n) - 1])
else:
print(a[a.index(n) + 1])