Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <numeric>
- using namespace std;
- double Average(const vector<int>& xs) {
- if (xs.empty()) {
- return 0;
- }
- double num = accumulate(xs.begin(), xs.end(), 0);
- return num / xs.size();
- }
- int main() {
- // не меняйте код main
- cout << Average({1,2,3}) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement