## 11. Counter, Arithmetic Mean and Division by Zero

### Division by Zero

What would happen in the program above if we were to type in 7 numbers, all smaller than 10? We suggest thinking about this case first, and then trying to execute the program to see what will really happen.

It is not possible to compute the arithmetic mean of a series of zero numbers. In the text of the program this error surfaces the moment the program requires the execution of a division by a number 0. That operation cannot be performed.

Upon division by zero, the program might crash, or do something unspecified. If compiled by Visual Studio 2015, this program displays rather strange value as a result. The division by zero is an undefined operation in C++, meaning that anything can happen. What does happen might depend on the compiler being used. Therefore, under no circumstances should you divide by zero!

This error is apparent in the text of the problem, too. The text does not specify what to do in case when all input values are smaller than or equal to 10. To be able to correct this error, the text of the problem needs to be modified. We could add to the text that, in case when no values are greater than 10, the program should just print out the message "No input values are greater than 10" and complete the execution. We leave to you the task of solving this modified version of the problem.