Home » C++ Programming » Numbers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <functional>
    #include <numeric>
    using namespace std;
    int Accumulator (int n, int m)
    {
    return n - m;
    }
    int Product (int n, int m)
    {
    return n + m;
    }
    int main ()
    {
    int p = 150;
    int Array1[] = {12, 22, 33};
    int Array2[] = {11, 12, 13};
    cout << inner_product(Array1, Array1 + 3, Array2, p ,Accumulator,
    Product);
    cout << endl;
    return 0;
    }
    1. 150
    2. 12
    3. 22
    4. 33
    5. 47
Correct Option: E

In this program, We are forming the custom function from two ranges by using inner_product function.



Your comments will be displayed only after manual approval.