The sum of all of the multiples of 3 or 5 below 1000.
1 2 3 4 5 6 7 | sum = 0 i = 0 while(i < 1000): if(i%5 == 0 or i%3 == 0): sum = sum + i i = i + 1 print sum |
Definitely not the best way to do it, but who am I kidding.
The sum of all of the multiples of 3 or 5 below 1000.
1 2 3 4 5 6 7 | sum = 0 i = 0 while(i < 1000): if(i%5 == 0 or i%3 == 0): sum = sum + i i = i + 1 print sum |
Definitely not the best way to do it, but who am I kidding.
You must be logged in to post a comment.