Skip to content

Commit 65d2e19

Browse files
authored
Create pythagoreanTriplets.py
1 parent ba6d79c commit 65d2e19

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pythagoreanTriplets.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
limit=int(input("Enter upper limit:"))
2+
c=0
3+
m=2
4+
while(c<limit):
5+
for n in range(1,m+1):
6+
a=m*m-n*n
7+
b=2*m*n
8+
c=m*m+n*n
9+
if(c>limit):
10+
break
11+
if(a==0 or b==0 or c==0):
12+
break
13+
print(a,b,c)
14+
m=m+1

0 commit comments

Comments
 (0)