1nums = [3, 5]
2
3result = 0
4for i in range(0,1000):
5 if i%3 == 0 or i%5 == 0:
6 result += i
7
8print(result)
9
1total = []
2
3for num in range(0,1001):
4 if (num % 3 == 0) or (num % 5 == 0):
5 total.append(num)
6
7print(sum(total))
1const findSum = n => {
2 let countArr = []
3
4 for(let i = 0; i <= n; i++) if(i % 3 === 0 || i % 5 === 0) countArr.push(i)
5 return countArr.reduce((acc , curr) => acc + curr)
6}
7console.log(findSum(5))