Which of the following will correctly calculate the average of the elements included in the nums array?
a. while (x < 4)
{
nums[x] = total + total;
x += 1;
} //end while
avg = static_cast<double>(total) /
static_cast<double>(x);
b. while (x < 4)
{
total += nums[x];
x += 1;
} //end while
avg = static_cast<double>(total) /
static_cast<double>(x);
c. while (x < 4)
{
total += nums[x];
x += 1;
} //end while
avg = static_cast<double>(total) /
static_cast<double>(x) – 1;
d. while (x < 4)
{
total += nums[x];
x += 1;
} //end while
avg = static_cast<double>(total) /
static_cast<double>(x - 1);
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.