Computer Science, asked by vaishnavi635, 6 months ago

write a program to input three sides of triangle and check whether it is right angle triangle or not...

ANSWER IN JAVA ....​

Answers

Answered by ArpitMishra506
3

CODE -

public class Triangle {

public static void main(int H, int B, int P){

/* H is hypotenuse, P is perpendicular, B is base */

int p=P*P; //Square of perpendicular

int b=B*B; // Square of base

int h=H*H; // Square of hypotenuse

if(h=p+b)

System.out.println("It is a right angled triangle ");

else

System.out.println("It is not a right angled triangle ");

}

}

LOGIC -

We are using the simple Pythagoras theorem here which states that -

In a right angled triangle

H^2 = P^2+B^2

where H is hypotenuse, P is perpendicular and B is base

Input - 10, 8, 6

Output - It is a right angled triangle

Input - 11, 5, 7

Output - It is not a right angled triangle

.

.

.

.

HOPE THIS HELPS YOU

.

.

.

.

PLEASE MARK AS BRAINLIEST AND FOLLOW ME TOO

Answered by sudhaclg59
0

Explanation:

IT'S ME ADITYA IX C IF YOU ARE MY CLASSMATES THEN MARK AS EXCELLENT

Attachments:
Similar questions