I hope this code is correct. I'm currently at work and on the phone with clients but at least the logic should be correct. Someone correct me if i'm wrong.
Code:
/* avg program */
#define MAX 30
#include <stdio.h>
#include <stdlib.h>
int main(void){
int count;
float num, avg;
for(count=0; count<=MAX; count++){
printf("Enter in num %d\n", count);
while( (scanf("%f", &num)) ==1 && num>0){
num+=num;
}Printf("Number must be 1 or greater\n");
continue;
}
float(avg) = num/MAX;
printf("The average is %f", avg);
system("pause");
return 0;
}
I'll check it when i get home. should work though.