what do you mean by uninitialized?
The code I posted, works fine and no errors
Here is what I tried with the If statements
Code:
#include <stdio.h>#include <stdlib.h>
int main(){
int maxNum=0, minNum=0, value, count=0, sum=0;
double average;
printf("To exit the program enter -1\n");
while(value!=-1){
printf("enter a value\n");
scanf("%d", &value);
count++;
sum = sum + value;
if(value > 0){
value = minNum;
value = maxNum;
}
if(value > maxNum)
value = maxNum;
if(value < minNum)
value = minNum;
}
count= count-1;
sum= sum+1;
average = (double)(sum/count);
printf("number of entries is %d and sum is %d\n", count, sum);
printf("the average is %.2lf\n", average);
printf("min is %d and max is %d", minNum, maxNum);
}
so youre saying I can just make sum as a double and then I wont need to multiply by the "double"