Ответ:
1)28
Решение на python:
for x in range(100):
k = x
i = 0
while i <= k:
i += 1
if i > 8:
i += 3
if i == 32:
print(x)
2)62
a = [2,14,7,3,1,6,8,12,7,5]
s = 0
for i in range(9):
if a[i] < a[i+1]:
t = a[i]
a[i] = a[i+1]
a[i+1] = t
s += a[i]
print(s)
3)2799
for i in range(10000):
x = i
k = 0
while x > 0:
k += 1
if (x % 10) == 7:
s = s + x
x = x // 10
if k == 4 and s == 27:
print(i)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
1)28
Решение на python:
for x in range(100):
k = x
i = 0
while i <= k:
i += 1
if i > 8:
i += 3
if i == 32:
print(x)
2)62
Решение на python:
a = [2,14,7,3,1,6,8,12,7,5]
s = 0
for i in range(9):
if a[i] < a[i+1]:
t = a[i]
a[i] = a[i+1]
a[i+1] = t
s += a[i]
print(s)
3)2799
Решение на python:
for i in range(10000):
x = i
s = 0
k = 0
while x > 0:
k += 1
if (x % 10) == 7:
s = s + x
x = x // 10
if k == 4 and s == 27:
print(i)