I was writing this program and I need to make it print out the minimum input, the maximum input, as well as the average. I've got it to print the average, but I don't know how to use limits.h to print out the min and max inputs.
This is what I have so far....
Code:
/*
* This program prints the smallest number, the largest number,
* and the average of all the numbers.
*/
#include <stdio.h>
#include <limits.h>
int main(void) {
int input;
int total;
int avg;
int count;
total = 0;
count = 0;
printf("enter some numbers, and then anything else to the end:\n");
while (scanf("%d", &input) == 1) {
total += input;
count = ++count;
printf("%d\n", input);
}
avg = total/count;
printf("smallest value is %d\n", INT_MIN);
printf("largest value is %d\n", INT_MAX);
printf("total is %d\n", total);
printf("count is %d\n", count);
printf("avg is %d\n", avg);
}
How would I give values to INT_MIN and INT_MAX?