Home » C++ Programming » Numbers » Question
  1. What is the output of this program?
     #include <iostream>
    #include <functional>
    #include <numeric>
    using namespace std;
    int myop (int p, int q)
    {
    return p + q;
    }
    int main ()
    {
    int value[] = {11, 12, 13, 15, 17};
    int Res[5];
    adjacent_difference (value, value + 7, Res);
    for (int k = 0; k < 5; k++)
    cout << Res[k] <<' ';
    return 0;
    }
    1. 11 1 1 2 2
    2. 11 1 1 2
    3. 1 2 2
    4. 1 2
    5. 1
Correct Option: A

In this program, We are calculating the adjacent difference of the given range by using function adjacent_difference.



Your comments will be displayed only after manual approval.