Home » C++ Programming » Functions » Question
  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    int Calculate (int p, int q)
    {
    return (p * q);
    }
    float Calculate (float p, float q)
    {
    return (p / q);
    }
    int main ()
    {
    int var1 = 4, var2 = 3;
    float num1 = 6.25, num2 = 5.35;
    cout << Calculate (var1, var2);
    cout << Calculate (num1, num2);
    return 0;
    }
    1. 12 1.58
    2. 12 0.005
    3. Compilation Error
    4. 12 1.25
    5. None of these
Correct Option: D

In this program, We are overloading the function and getting the output as 12 and 1.25 by division and multiplication.



Your comments will be displayed only after manual approval.