1 /*C How to Program, 6/E, Deitel & Deitel.
3 Solution of exercise 2.19:
4 (Arithmetic, Largest Value and Smallest Value) Write a program that inputs
5 three different integers from the keyboard, then prints the sum, the average,
6 the product, the smallest and the largest of these numbers. Use only the
7 single-selection form of the if statement you learned in this chapter. The
8 screen dialogue should appear as follows:
10 Input three different integers: 13 27 14
17 Written by Juan Carlos Moreno (jcmhsoftware@gmail.com), year 2018.*/
23 int a
; /*First integer*/
24 int b
; /*Second integer*/
25 int c
; /*Third integer*/
27 printf("Input three different integers: ");
32 printf("Sum is %d\n", a
+ b
+ c
);
33 printf("Average is %d\n", (a
+ b
+ c
)/3);
34 printf("Product is %d\n", a
* b
* c
);
36 /*Print the smallest integer*/
41 printf("Smallest is %d\n", a
);
48 printf("Smallest is %d\n", b
);
55 printf("Smallest is %d\n", c
);
59 /*Print the largest integer*/
64 printf("Largest is %d\n", a
);
71 printf("Largest is %d\n", b
);
78 printf("Largest is %d\n", c
);