A pythagorean triplet is a set of three integers a, b and c such that a**2+b**2=c**2.in the given limit L, find the number of pythagorean triplets R that can be formed (such that a<b<c).
L=int(input("Enter a limit: "))
count=0
for a in range(1,L-1):
for b in range(a+1,L):
for c in range(b+1,L+1):
x=a*a
y=b*b
z=c*c
if (x+y==z):
count+=1
print(count)
Comments
Leave a comment