# Larger And Smaller Value C Program

Question: Write a program that inputs three different integers from the keyboard, then prints the sum, the average, the product, the smallest and the largest of these numbers. Use only the single-selection form of the if statement you learned in this chapter. The screen dialogue should appear as follows:

```/*
* Author: AGHATISE OSAZUWA
* Website: www.cscprogrammingtutorials.com
*
* Program that calculate the circumference and area of a circle.
*/

#include <stdio.h>
int main ( ){
int num1, num2, num3, sum, ave, prod, min, max;
printf("Enter three numbers: ");
scanf("%d%d%d", &num1, &num2, &num3);
sum = num1 + num2 + num3;
ave = (num1 + num2 + num3) / 3;
prod = num1 * num2 * num3;
printf("Sum is %d\n", sum);
printf("Average is %d\n", ave);
printf("Product is %d\n", prod);

// Let's assume num1 is the minimum(smallest) number
min = num1;
if (num2 < min){
min = num2;
}
if (num3 < min){
min = num3;
}
printf("Smallest is %d\n", min);

// Let's assume num1 is the maximum(largest) number
max = num1;
if (num2 > max){
max = num2;
}
if (num3 > max){
max = num3;
}
printf("Largest is %d\n", max);
return 0;
}
```
 Program output
Click here to see other solutions to Deitel C How To Program exercises.