sum of all multiples of 3 and 5 below 100
c = list(range(1,100))
total = 0
for i in (c):
if i % 3 == 0 or i % 5 == 0:
total += i
print (total)
sum of all multiples of 3 and 5 below 100
c = list(range(1,100))
total = 0
for i in (c):
if i % 3 == 0 or i % 5 == 0:
total += i
print (total)
find the sum of all the multiples of 3 or 5 below 1000 python
nums = [3, 5]
result = 0
for i in range(0,1000):
if i%3 == 0 or i%5 == 0:
result += i
print(result)
Sum of all the multiples of 3 or 5
const findSum = n => {
let countArr = []
for(let i = 0; i <= n; i++) if(i % 3 === 0 || i % 5 === 0) countArr.push(i)
return countArr.reduce((acc , curr) => acc + curr)
}
console.log(findSum(5))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us