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 + 1;
    }
    int main ()
    {
    int value[] = {11, 12, 13, 14, 15, 16};
    int Res[5];
    partial_sum (value, value + 5, Res);
    for (int k = 0; k < 6; k++)
    cout << Res[k] << ' ';
    return 0;
    }
    1. 11 23 36
    2. 50 65 0
    3. 23 36 50
    4. 11 23 36 50 65 0
    5. None of these
Correct Option: D

In this program, We are calculating the sum of the given range by using partial_sum function.



Your comments will be displayed only after manual approval.