Skip to content

Commit c2aa074

Browse files
authored
Create 001
solution for problem 001
1 parent 6e24935 commit c2aa074

File tree

1 file changed

+25
-0
lines changed
  • project_euler/problem_001

1 file changed

+25
-0
lines changed

project_euler/problem_001/001

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# solved #001
2+
"""
3+
Project Euler Problem 1: https://projecteuler.net/problem=1
4+
5+
Multiples of 3 or 5
6+
7+
"""
8+
9+
def solution(n: int = 1000) -> int:
10+
"""
11+
For number i in 1 to 1000 we take modulus of 3 and 5 with each number and when any of their value is zero we add that number to sum_count varialbe.
12+
13+
"""
14+
n = 1000
15+
sum_count = 0
16+
for i in range(1,n+1):
17+
if i%3==0 or i%5==0:
18+
sum_count += i
19+
20+
return sum_count
21+
22+
23+
if __name__ == "__main__":
24+
print(f"{solution() = }")
25+

0 commit comments

Comments
 (0)