Right Angle Triangle - Python - Spicy Coders

Recent

Saturday, September 02, 2017

Right Angle Triangle - Python

The length of the three sides of a triangle A, B and C are passed as the input. The program must check it it's a right angled triangle. Print YES or NO based on the check. 

Input Format:
The first line contains A. 
The second line contains B. 
The third line contains C. 

Output Format: The first line contains YES or NO 

Boundary Conditions: 
  • 1 <= A, B, C <= 9999 

Example Input/Output 1: 
Input: 
3

Output: 
YES

Example Input/Output 2: 
Input: 
11 
9

Output: 
NO

Source Code:

a,b,c=int(input()),int(input()),int(input())
a,b,c=sorted([a,b,c])
r=abs(a**2+b**2-c**2)
if r<0.1:
    print("YES")
else:

    print("NO")

3 comments:

  1. Really appreciated the information and please keep sharing, I would like to share some information regarding online training.Maxmunus Solutions is providing the best quality of this PYTHON programming language. and the training will be online and very convenient for the learner.This course gives you the knowledge you need to achieve success.

    For Joining online training batches please feel free to call or email us.
    Email : minati@maxmunus.com
    Contact No.-+91-9066638196/91-9738075708
    website:-http://www.maxmunus.com/page/Python-Training

    ReplyDelete
  2. Those rules moreover attempted to wind up plainly a decent approach to perceive that other individuals online have the indistinguishable enthusiasm like mine to get a handle on incredible arrangement more around this condition

    python training in bangalore|

    ReplyDelete
  3. Superb description for python.Hats off for your simple description with a clear example.
    moto service center in chennai

    ReplyDelete