Function Call

Q.

What is the output of this program?

1.
    #include 
2.
    using namespace std;
3.
    int operate (int a, int b)
4.
    {
5.
        return (a * b);
6.
    }
7.
    float operate (float a, float b)
8.
    {
9.
        return (a / b);
10.
    }
11.
    int main ()
12.
    {
13.
        int x = 5, y = 2;
14.
        float n = 5.0, m = 2.0;
15.
        cout << operate (x, y);
16.
        cout << operate (n, m);
17.
        return 0;
18.
    }
A. 119
B. 102.5
C. 123.4
D. none of the mentioned

Answer : Option B

Explanation :

:In this program, We are overloading the function and getting the output as 10 and 2.5 by division 

and multiplication.
Output:
$ g++ call3.cpp
$ a.out
102.5