105
Chapter 8: C Programming
6. When x reaches 60, the For loop is finished, and the average is calculated.
average = total/60;
7. ISACC automatically rounds numbers down. This section of code rounds the value of
average up to the next whole number according to the remainder left over during division. If
the remainder is greater than 30, average is rounded up.
if ((total % 60) >= 30)
{
average = average + 1;
8. This line sets the value of input 2 to the hourly average just calculated.
set_input(2,average);