Open this paste on another device
The QR code contains the clean paste URL. It contains no password or delete token.
cppRead-only
1
#include <numeric>
#include <span>
#include <stdexcept>
double average(std::span<const double> values) {
if (values.empty()) {
throw std::invalid_argument("values must not be empty");
}
const double sum = std::accumulate(values.begin(), values.end(), 0.0);
return sum / static_cast<double>(values.size());
}
Paste details
- Visibility
- Public
- Size
- 332 bytes
- Protection
- Standard link access
- Retention
- No automatic expiry
Share with confidence
Unlisted links are not searchable, but anyone with the URL can open them. Never paste live credentials or personal data.