It's apple season, and the apples have to be packed! Debug a function called
BoxesNeeded() which takes one input. The input value represents a number of
apples that need to be packed into boxes. Each box can store a maximum of 20
apples. The function should return the minimum number of boxes needed to store
the given number of apples.
Examples: BoxesNeeded(13) should return 1. BoxesNeeded(-13) should return
0.
BoxesNeeded should not throw an exception.
The function prototype is int BoxesNeeded(int apples).
START by correcting the syntax error(s), if any.
code.cpp
New
1 int BoxesNeeded(int apples)
2 {
3
4 if(apples < 0)
5 return 0;
6 else
7 {
8 return (apples/20) + 1;
9 }
10}