#include <stdio.h>
int main ()
{
/* variable definition: */
int input,count, value, sum;
double avg;
/* Initialize */
count = 0;
sum = 0;
avg = 0.0;
// Enter the amount of numbers to calculate the average
// Loop through to input values
printf("Enter the total amount of numbers you will enter \n");
scanf("%d", input);
while (count < input)
{
printf("Enter a positive Integer\n");
scanf("%d", &value);
if (value >= 0) {
sum = sum + value;
count = count + 1;
}
else {
printf("Value must be positive\n");
}
}
// Calculate avg. Need to type cast since two integers will yield an integer
avg = (double) sum/count;
printf("average is %lf\n " , avg );
return 0;
}