1:
a = int(input('Введите натуральное число: '))
a = abs(a)
b = 0
i = 0
while True:
b += (1 if (a%10)%4 == 0 else a%10) * 10**i
a = a // 10
i += 1
if a == 0: break
print(b)
2:
while a > 0:
if (a%10)%2 != 0:
else:
b += a%10 * 10**i
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
1:
a = int(input('Введите натуральное число: '))
a = abs(a)
b = 0
i = 0
while True:
b += (1 if (a%10)%4 == 0 else a%10) * 10**i
a = a // 10
i += 1
if a == 0: break
print(b)
2:
a = int(input('Введите натуральное число: '))
a = abs(a)
b = 0
i = 0
while a > 0:
if (a%10)%2 != 0:
a = a // 10
else:
b += a%10 * 10**i
a = a // 10
i += 1
print(b)