Question PRG-CPP-0072
HardWhat is the output of this program?
#include <iostream>
#include <algorithm>
#include <numeric>
using namespace std;
int main() {
int arr[] = {5, 2, 8, 1};
sort(arr, arr + 4, [](int x, int y) { return x > y; });
cout << arr[0] << arr[3] << accumulate(arr, arr + 4, 0);
return 0;
}
- A.
8116
- B.
5116
- C.
Sign up free to see the answer and a step-by-step explanation.