Abdullah_A_lAsif_001

triangle valid or not valid

May 25th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.  
  5.     double a, b, c, temp;
  6.  
  7.     scanf("%lf %lf %lf", &a, &b, &c);
  8.  
  9.     if (a < b)
  10.  
  11.     {
  12.         temp = a;
  13.         a = b;
  14.         b = temp;
  15.     }
  16.  
  17.     if (b < c)
  18.  
  19.     {
  20.         temp = b;
  21.         b = c;
  22.         c = temp;
  23.     }
  24.  
  25.     if (a < b)
  26.     {
  27.         temp = a;
  28.         a = b;
  29.         b = temp;
  30.     }
  31.  
  32.     if (a >= b + c)
  33.  
  34.     {
  35.         printf("the triangle not valid\n");
  36.     }
  37.  
  38.     else if (a * a == b * b + c * c)
  39.  
  40.     {
  41.         printf("the triangle valid\n");
  42.     }
  43.  
  44.     else if (a * a > b * b + c * c)
  45.  
  46.     {
  47.         printf("the triangle valid\n");
  48.     }
  49.  
  50.     else if (a * a < b * b + c * c)
  51.  
  52.     {
  53.         printf("the triangle valid\n");
  54.     }
  55.  
  56.     return 0;
  57.  
  58. }
Add Comment
Please, Sign In to add comment