SHARE
TWEET

Problem 1 (TriAngles)

a guest Nov 17th, 2019 142 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Three natural numbers А, B and C are entered from the SI.
  2.  
  3. Write a program that will check if the three entered numbers can represent the values of the angles (in degrees) of a triangle. If the values can represent angles of a triangle print YES in the first line of the standard output followed by type of the triangle (RIGHT, ACUTE or OBTUSE) in the next line. If triangle is not possible with the tree given angles print NO in a single line.
  4.  
  5. Examples:
  6.  
  7. Example 1:
  8.  
  9. 60 40 80
  10.  
  11. YES
  12.  
  13. ACUTE
  14.  
  15. Example 2:
  16.  
  17. 100 50 30
  18.  
  19. YES
  20.  
  21. OBTUSE
  22.  
  23. Example 3:
  24.  
  25. 100 50 50
  26.  
  27. NO
  28. __________________________________________________________
  29.  
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32.  
  33. int main()
  34. {
  35.     int a, b, c;
  36.     scanf("%d %d %d", &a, &b, &c);
  37.  
  38.     if(a+b+c == 180){
  39.         printf("YES\n");
  40.         if((a==90) || (b==90) || (c==90)){
  41.             printf("RIGHT\n");
  42.         }else if((a<90)&&(b<90) && (c<90)){
  43.             printf("ACUTE\n");
  44.         }else if((a>90) || (b>90) || (c>90)){
  45.             printf("OBTUSE\n");
  46.         }
  47.     }else
  48.         printf("NO\n");
  49.  
  50.     return 0;
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top