n = input()
sum = 0
if int(n) > 10**9:
print(n,"больше заданного диапазона")
else:
if int(n) % 2 == 0:
for i in range(len(n)//2):
sum += int(n[i])
for i in n:
sum += int(i)
print(sum)
123456
6
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Код:
n = input()
sum = 0
if int(n) > 10**9:
print(n,"больше заданного диапазона")
else:
if int(n) % 2 == 0:
for i in range(len(n)//2):
sum += int(n[i])
else:
for i in n:
sum += int(i)
print(sum)
Вывод:
123456
6