Home » C++ Programming » Functions » Question
  1. What is the output of this program?
    #include <iostream>
    #include <algorithm>
    using namespace std;
    bool Function(int k, int L)
    {
    return k < L;
    }
    int main ()
    {
    int Array[ ] = {31, 17, 12, 51, 16, 14};
    cout << *min_element(Array, Array + 6, Function) << " ";
    cout << *max_element(Array, Array + 6, Function) ;
    return 0;
    }
    1. 17 31
    2. 31 17
    3. 51 21
    4. 12 51
    5. Compilation Error
Correct Option: D

In this program, We found out the minimum value and maximum value of a range.



Your comments will be displayed only after manual approval.