Answer:
// here is program in C.
// include header
#include <stdio.h>
#include<math.h>
//main function
int main()
{
// variables
int x,y,z;
int flag=0;
// ask to enter the sides of triangle
printf("enter the length of all sides of triangle:");
// read the sides
scanf("%d %d %d",&x,&y,&z);
// check if square of any side is equal
//to sum of square of other two sides
if((x*x)==(y*y)+(z*z)||(y*y)==(x*x)+(z*z)||(z*z)==(y*y)+(x*x))
flag=1;
// if right angled triangle
if(flag==1)
printf("right angled triangle.\n");
// if not right angled triangle
else
printf(" not a right angled triangle.\n");
return 0;
}
Explanation:
Read the sides of the triangle and assign them to x,y,z respectively.Then check ((x*x)==(y*y)+(z*z)||(y*y)==(x*x)+(z*z)||(z*z)==(y*y)+(x*x)).If it true then set flag=1.After this if flag==1 then print triangle is right angled else not right angled.
Output:
enter the length of all sides of triangle:3 4 5
right angled triangle.