MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / average

Function average

Examples/NoModules/Chapter 08/Ex8_05.cpp:14–20  ·  view source on GitHub ↗

Function to compute an average

Source from the content-addressed store, hash-verified

12
13// Function to compute an average
14double average(double array[], size_t count)
15{
16 double sum {}; // Accumulate total in here
17 for (size_t i {}; i < count; ++i)
18 sum += array[i]; // Sum array elements
19 return sum / count; // Return average
20}

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected