# Untitled

Sep 8th, 2016
1,145
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. //------------------------------------------------------------------------------------------------------------------------------
2. //                                                                  Exercise 4
3. //                                                                  ----------
4. //
5. // General : The program will get three angles and prints weather those angles are legal for a triangle or not. If they do, it will also print the kind of the triangle.
6. //
7. // Input   : Three numbers that should represent triangle angles.
8. //
9. // Process : The program checks weather the sum of the angles is 180 and that they are above zero.
10. //
11. // Output  : Prints if those are legal angles for a triangle, and the kind of the triangle.
12.
13. //
14. //------------------------------------------------------------------------------------------------------------------------------
16. // Date: 9.9.2016
17. //------------------------------------------------------------------------------------------------------------------------------
18.
19. #include <stdio.h>
20. #define sum_of_angels num1+num2+num3
21. typedef char bool;
22. #define TRUE 1
23. #define FALSE 0
24. void main(void)
25. {
26.     float num1;
27.     float num2;
28.     float num3;
29.     char FLAG = TRUE;
30.     printf("Please enter the first angle: ");
31.     scanf_s("%f", &num1);
32.     printf("Please enter the second angle: ");
33.     scanf_s("%f", &num2);
34.     printf("Please enter the third angle: ");
35.     scanf_s("%f", &num3);
36.     if (sum_of_angels != 180 && num1>0 && num2>0 && num3>0)
37.     {
38.         printf("Cant be");
39.         FLAG = FALSE;
40.
41.     }
42.     else
43.     {
44.         printf("Those are ilegal angles for triangle which is a ");
45.     }
46.     if (num1 < 90 && num2 < 90 && num3 < 90 && FLAG != FALSE)
47.     {
48.         printf("Sharp angle triangle");
49.
50.     }
51.     if (num1 > 90 || num2 > 90 || num3 > 90 && FLAG != FALSE)
52.     {
53.         printf("Obtuse angle triangle");
54.
55.     }
56.     if (num1 == 90 || num2 == 90 || num3 == 90 && FLAG != FALSE)
57.     {
58.         printf("Right triangle");
59.     }
60. }