adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    double division(int a, int b)
    {
        if (b == 0) 
        {
            throw "Division by zero condition!";
        }
        return (a / b);
    }
    int main ()
    {
        int x = 50;
        int y = 2;
        double z = 0;
        try 
        {
            z = division(x, y);
            cout << z;
        }
        catch(const char *msg) 
        {
            cerr << msg;
        }
        return 0;
    }

a.

25

b.

20

c.

Division by zero condition!

d.

None of the mentioned

Answer: (a).25

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?