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 = 0;
        double z = 0;
        try 
        {
            z = division(x, y);
            cout << z << endl;
        }
        catch (const char* msg) 
        {
            cout << msg << endl;
        }
        return 0;
    }

a.

50

b.

0

c.

Division by zero condition!

d.

None of the mentioned

Answer: (c).Division by zero condition!

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?