Sunday, December 5, 2010

Project Euler - Python - Problem 1

I love solving the Project Euler problems so if I am going to be learning a new language why not utilize that website to learn the languages?!

Problem 1 in Python (Brute-force):

x, z = 0, 0
while x < 1000:
    if x % 3 == 0 or x % 5 == 0:
        z+=x
    x+=1
print(z)


No comments: