Skip to content

Instantly share code, notes, and snippets.

@crissyg
Created July 19, 2017 14:58
Show Gist options
  • Save crissyg/10eab52fa05294e4dbea00f2bafbde66 to your computer and use it in GitHub Desktop.
Save crissyg/10eab52fa05294e4dbea00f2bafbde66 to your computer and use it in GitHub Desktop.
Find the sum of all the multiples of 3 or 5 below n .
#!/bin/python3
import sys
t = int(input().strip())
for a0 in range(t):
n = int(input().strip())
sum=0
for i in range(1, n):
if (i % 3==0) or (i % 5==0):
sum +=i
print (sum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment