Home » C++ Programming » Overloading » Question
  1. What is the output of the following program?
    #include 
    using namespace std;
    int calculate(int p, int q)
    {
    return (p * q);
    }
    float calculate (float p, float q)
    {
    return (p / q);
    }
    int main()
    {
    int n = 10, m = 3;
    float r = 30.0, s = 10.0;
    cout << calculate(n, m) <<" ";
    cout << calculate (r, s);
    return 0;
    }
    1. 10 3
    2. 30.0 10.0
    3. 30 3
    4. Compilation Error
    5. None of these
Correct Option: C

In this program, we are divide and multiply the values.



Your comments will be displayed only after manual approval.