Advertisement
Nabil-Ahmed

Untitled

Jun 20th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. //Input angles of a triangle and check whether triangle is valid or not//
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6.     int a1,a2,a3,sum;
  7.  
  8.     printf("Enter the angles of triangle:");
  9.     scanf("%d %d %d",&a1,&a2,&a3);
  10.  
  11.     sum=a1+a2+a3;
  12.  
  13.     if(sum == 180 && a1 > 0 && a2 >0 && a3 > 0)
  14.     {
  15.         printf("Triangle is valid");
  16.     }
  17.     else
  18.     {
  19.         printf("Triangle is not valid");
  20.     }
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement