[Project Euler Problem 1]Multiples of 3 and 5

2015. 7. 16. 01:27
def criterion(x):
    if x%3 == 0 or x%5 == 0:
        return 1
    return 0

if __name__=="__main__":
    result = 0
    for i in range(1000):
        if criterion(i):
            result += i
    print "The answer is %d" % result

.

Algorithm/Project Euler