mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 13:31:07 +00:00
Add files via upload
This commit is contained in:
parent
54f6d1f6d7
commit
1568432e82
32
Project Euler/Problem 01/sol4.py
Normal file
32
Project Euler/Problem 01/sol4.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
def mulitples(limit):
|
||||||
|
xmulti = []
|
||||||
|
zmulti = []
|
||||||
|
z = 3
|
||||||
|
x = 5
|
||||||
|
temp = 1
|
||||||
|
while True:
|
||||||
|
result = z * temp
|
||||||
|
if (result < limit):
|
||||||
|
zmulti.append(result)
|
||||||
|
temp += 1
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
temp = 1
|
||||||
|
break
|
||||||
|
while True:
|
||||||
|
result = x * temp
|
||||||
|
if (result < limit):
|
||||||
|
xmulti.append(result)
|
||||||
|
temp += 1
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
temp = 1
|
||||||
|
break
|
||||||
|
return (sum(zmulti) + sum(xmulti))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print (mulitples(100))
|
Loading…
Reference in New Issue
Block a user