This problem has happened to me twice.Both times during programming with Borland C++.when i wanted to run the simple code bellow:(completely what I wrote)
int n, total=0, counter=1,average;
while ( n )
{
cin >> n;
total = total + n;
average = total / counter;
counter++;
cout <<average<<endl;
}