import random
A = []
p = 1
k = int(input("k = "))
for i in range(14):
A.append(random.randint(-2,31))
if A[i] % k == 0:
p *= A[i]
print(A)
print(p)
k = 5
[4, 29, 3, 31, 21, 24, 23, 30, 15, 2, 4, 15, 3, 21]
6750
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Код:
import random
A = []
p = 1
k = int(input("k = "))
for i in range(14):
A.append(random.randint(-2,31))
if A[i] % k == 0:
p *= A[i]
print(A)
print(p)
Вывод:
k = 5
[4, 29, 3, 31, 21, 24, 23, 30, 15, 2, 4, 15, 3, 21]
6750