If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. the sum of these multiples is 23.find the sum of all the multiples of 3 or 5 below 1000
Answers
Answered by
1
step 1
the sum of all the multiples of 3 below 1000
= 3+6+9+18+.................+999
= 3(1+2+3+......................+333)
= 3 (333 x 334) / 2 (using formula sum of the nos. ={ n x (n+1) } / 2
= 3 x 55611 = 166833
step 2
the sum of all the multiples of 5 below 1000
= 5+10+15+20+..........................+995
= 5 ( 1+2+3+4+ ............................+ 199)
= 5 ( 199 x 200) /2
= 5 x 19900 = 99500
step 3
the sum of all the multiples of 3 or 5 below 1000
= 166833 + 99500
= 266333
the sum of all the multiples of 3 below 1000
= 3+6+9+18+.................+999
= 3(1+2+3+......................+333)
= 3 (333 x 334) / 2 (using formula sum of the nos. ={ n x (n+1) } / 2
= 3 x 55611 = 166833
step 2
the sum of all the multiples of 5 below 1000
= 5+10+15+20+..........................+995
= 5 ( 1+2+3+4+ ............................+ 199)
= 5 ( 199 x 200) /2
= 5 x 19900 = 99500
step 3
the sum of all the multiples of 3 or 5 below 1000
= 166833 + 99500
= 266333
Answered by
0
Answer:
I SUPPOSE THIS A PRORMMING QUESTION SO HERE IS THE ANSWER
Step-by-step explanation:
for i in range(3):
num=int(input(''))
def mul(num,x):
if num%x!=0:
num-=num%x
n=(num//x)+1
s=(n/2)*(0+(n-1)*x)
elif num%x==0:
num-=x
n=(num//x)+1
s=(n/2)*(0+(n-1)*x)
return s
answer=int(mul(num,3)+mul(num,5)-mul(num,15))
if answer>0:
print(answer)
Similar questions