Tracing a force accumulator

During a calibration simulation, four force readings are generated by the expression 2.5 + 0.5 * i, with forces measured in newtons. The following C code calculates their mean:


C
double total_N = 0.0;
for (int i = 0; i < 4; ++i)
{
    total_N += 2.5 + 0.5 * i;
}
double mean_N = total_N / 4.0;


What value is stored in mean_N? Give your answer in N, to two decimal places.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More C Basics Questions: