Support our Blind Hand Charity by donating at 9818291723. Your contribution has the potential to bring about significant positive change for humanity.

Search This Blog

MY PROGRAMMES

Sunday, April 9, 2023

FINDING THE PYTHAGOREAN TRIPLETS

m=int(input("Enter the digit = "))
while m!=0:
    if (2*m)%10==0:
        print("The triplets are",2*m,(m**2)-1,(m**2)+1,end="")
        break
    elif ((m+1)**0.5)%2==0:
        print("The triplets are",2*m,(m**2)-1,(m**2)+1,end="")
        break
    elif ((m-1)**0.5)%2==0:
        print("The triplets are",2*m,(m**2)-1,(m**2)+1,end="")
        break
    else:
        print("No pythagorean triplets possible",end="")