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.
right angle triangle in c


  1. #include<stdio.h>
  2. // write a c program too check traingle is right angle triasngle or not
  3. //www.instanceofjava.com
  4. int main()
  5. {
  6.      int angle1,angle2,angle3;
  7.      printf("Enter Three Angles of Triangle");
  8.      printf("\n-------------------------------\n");
  9.      printf("Enter Angle1  : ");
  10.      scanf("%d", &angle1);
  11.      printf("\nEnter  Angle2 : ");
  12.      scanf("%d",&angle2);
  13.      printf("\nEnter  Angle2  : ");
  14.      scanf("%d",&angle3);
  15.      printf("--------------------------------\n");
  16.      if(angle1+angle2+angle3==180) 
  17.      {
  18.          
  19.           if(angle1==90 || angle2==90 || angle3==90)
  20.           {
  21.                printf("\nTriangle is Right Angle Triangle\n"); //
  22.           }
  23.          
  24.      }
  25.      else
  26.      {
  27.           printf("\nIts Not a Triangle ");
  28.      }
  29.     getch();
  30. }


Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu