Coordinating a loop and its mean

A test program generates five force readings according to Fi=(2.0 N)iF_i = (2.0\ \text{N})i for integer indices i=1,2,3,4,5i = 1, 2, 3, 4, 5. Immediately before one of the fragments below runs, the program declares


C
double total_N = 0.0;


Which fragment correctly includes all five readings, calculates their arithmetic mean, and prints it in newtons to one decimal place? Assume stdio.h has been included and the fragment is inside main.

Choose an answer

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: