Created
July 19, 2017 14:58
-
-
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 .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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