## Write a C program to check whether a triangle is right angle triangle

Write a C program to check whether a triangle is a right-angle triangle, in this C program example, we will see how to check a triangle is a right angle triangle by using an if-else statement.

Enter side a:6

Enter side b:8

Enter side c:10

#### Sample output

The triangle is a right angle triangle

#### Sample Input – 2

Enter side of a:5

Enter side b:7

Enter side c:14

#### Sample output

The triangle is not a right-angle triangle

# Algorithm to check a triangle is right angle triangle

• Declare three variables and initialize one variable.
• Take three inputs for taking sides of a triangle from the user.
• Give the logic of the right-angle triangle.
• Take the if-else statement and give a condition on it.
• Print an appropriate message in statements.

# C program to check  a triangle is right angle triangle

```#include<stdio.h>
#include<math.h>
void main (){
int a,b,c,sum=0;
printf("enter the value of side a:");
scanf("%d",&a);
printf("enter the value of side b:");
scanf("%d",&b);
printf("enter the value of side c:");
scanf("%d",&c);

a=pow(a,2);
b=pow(b,2);
c=pow(c,2);
sum=a+b;
if(sum==c){
printf("the triangle is a right angle triangle");
}
else{
printf("the triangle is not a right angle triangle");
}

}```

# Explanation of this C program

Step 1: Star.

Step 2: Create a header file and include the library on it.

Step 3: Then create a void main function.

Step 4: Declare  three variables (a,b,c) and initialize one variable (sum=0).

step 5: Create three inputs with the help of scanf for taking three sides from the user.

step 6: create the logic of the right-angle triangle with the help of pow (a*a+b*b=c*c).

step 7: Create an if-else statement to print an appropriate message and give conditions in a statement (sum==c).

step 8: End.

# Output In this way, we will see how to write a C program to check whether a triangle is a right-angle triangle.