in addition, this expression
sum / counter will do
integer division; ie. if sum ==23 and counter==7, the result would be 3, not 3.28. you could either make sum a double or write
double(sum) / counter to get the fractional part.
it is also a good idea to get into the habit of initializing a variable at the point of definition; this will protect you from silly errors (using uninitialized variables) and later, when you deal with more complex types, help you write more efficient code. ie. not
int counter;
int sum;
int limit;
limit = 7;
sum = 0;
counter = 0;
but
int counter = 0 ;
int sum = 0 ;
int limit = 7 ;
also, since limit is a constant, declare it as such eg
const int limit = 7 ;
or
enum { limit = 7 } ;
how you write code later is going to be determined to a large extent by the habits you form in the early days; forming good habits now (some people call this programming hygiene) would serve you well in the future,