I am trying to design a program that ask the user to enter 5 integer, then the program will calculate the average
The error I got it is an infinite loop .Code:#include<stdio.h>
int main()
{
int num;
int counter, total, average;
total=0;
counter =0;
while ( counter<5 ) {
printf("Enter number:");
scanf("%d" , &num );
total += num;
}
average= total/5;
printf("average is %d" , average);
return 0;
}
what should i do about it ?
thank you