Originally Posted by
WaltP
What variable are you 'scanf'ing into?
What variable is holding your total?
Is there a conflict?
expalain that a bit more to me on where the problem lay walt. I coded it on the fly so i was expecting it to work. Here is a corrected version,Define MAX to be whatever u want
Code:
#include <stdio.h>
#include <stdlib.h>
#define MAX 4
int main(void){
int count;
float num, avg;
for(count=1; count<=MAX; count++){
printf("Enter in num %d\n", count);
scanf("%f", &num);
num+=num;
avg = num/MAX;
}
printf("The average is %.2f\n", avg);
system("pause");
return 0;
}