Q499
What will be the output of the following C++ code? #include 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 << " Bad Operator: " << Str; return 0;
A.
10
B.
2
C.
Bad Operator
D.
10 / 5 = 2
AnswerAnswer: Option D
Solution
Answer: Option D
No explanation is given for this question Let's Discuss on Board