Added exercise 3.44
[C-Deitel-Exercises.git] / Chapter-3 / 3-44.c
blobf75e1f2df97520b523d243636e8a2353cee80f4b
1 /*C How to Program, 6/E, Deitel & Deitel.
3 Solution of exercise 3.44:
4 (Sides of a Triangle) Write a program that reads three nonzero float values
5 and determines and prints if they could represent the sides of a triangle.
7 Modified by Juan Carlos Moreno (jcmhsoftware@gmail.com), 2023-03-21.*/
9 #include <stdio.h>
11 int main(void)
13 /*The nonzero float values*/
14 float first_value;
15 float second_value;
16 float third_value;
18 /*Enter the three nonzero float values*/
19 printf("Enter the first integer: ");
20 scanf("%f",&first_value);
21 printf("Enter the second integer: ");
22 scanf("%f", &second_value);
23 printf("Enter the third integer: ");
24 scanf("%f", &third_value);
26 if ((first_value + second_value > third_value) &&
27 (first_value + third_value > second_value) &&
28 (second_value + third_value > first_value))
30 printf("The values could represent the sides of a triangle.\n");
32 else
34 printf("The values could no represent the sides of a triangle.\n");
37 return 0;