c program to check whether the triangle is right angled triangle
- To check right angle triangle or not first we need to check sum of all three angles
- If sum of all three angles is 180 then we it should satisfy second condition also
- Second condition is on of the angle should be 90.
- if both the conditions are passed then we can say it is a right angle triangle.
- Now lets write a c program to check triangle is right angle triangle or not.
- #include<stdio.h>
- // write a c program too check traingle is right angle triasngle or not
- //www.instanceofjava.com
- int main()
- {
- int angle1,angle2,angle3;
- printf("Enter Three Angles of Triangle");
- printf("\n-------------------------------\n");
- printf("Enter Angle1 : ");
- scanf("%d", &angle1);
- printf("\nEnter Angle2 : ");
- scanf("%d",&angle2);
- printf("\nEnter Angle2 : ");
- scanf("%d",&angle3);
- printf("--------------------------------\n");
- if(angle1+angle2+angle3==180)
- {
- if(angle1==90 || angle2==90 || angle3==90)
- {
- printf("\nTriangle is Right Angle Triangle\n"); //
- }
- }
- else
- {
- printf("\nIts Not a Triangle ");
- }
- getch();
- }
No comments