+ 2
Python compute
compute sum of all intergers that are multiples of 9 from 1-250
6 Antworten
+ 6
print(3402)
+ 4
# Sum of multiples of k lower from 1 to n
print(k*(n//k)*(n//k+1)//2)
+ 3
print(sum([_ for _ in range(1, 251) if _ % 9 == 0]))
+ 3
+ 3
sum = 0
for i in range(9,251,9):
sum += i
+ 1
is 3402 the correct answer?