Advertisement
Guest User

Problem - 6 : Triangle is valid or not

a guest
May 24th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int a,b,c,valid = 0;
  6.  
  7.     printf("Enter three sides of triangle : ");
  8.     scanf("%d %d %d", &a, &b, &c);
  9.  
  10.     if((a + b) > c)
  11.  
  12.     {
  13.  
  14.         if((b + c) > a)
  15.  
  16.         {
  17.  
  18.             if((a + c) > b)
  19.  
  20.             {
  21.  
  22.                 valid = 1;
  23.  
  24.             }
  25.  
  26.         }
  27.  
  28.     }
  29.  
  30.     if(valid == 1)
  31.  
  32.     {
  33.  
  34.         printf("Triangle is valid\n");
  35.  
  36.     }
  37.  
  38.     else
  39.  
  40.     {
  41.  
  42.         printf("Triangle is not valid\n");
  43.  
  44.     }
  45.  
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement