We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e24935 commit c2aa074Copy full SHA for c2aa074
project_euler/problem_001/001
@@ -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