adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
        double a = 10, b = 5, res;
        char Operator = '/';
        try 
        {
            if (b == 0)
                throw "Division by zero not allowed";
            res = a / b;
            cout << a << " / " << b << " = " << res;
        }
        catch(const char* Str)
        {
            cout << "\n Bad Operator: " << Str;
        }
        return 0;
    }

a.

10

b.

2

c.

Bad Operator

d.

10 / 5 = 2

Answer: (d).10 / 5 = 2

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?