1.

What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
double num1 = 9, num2 = 3, Result;
char Operator = '/';
try
{
if (num2 == 0)
throw "Division by zero not allowed";
Result = num1 / num2;
cout << num1 << " / " << num2 << " = " << Result;
}
catch(const char* S)
{
cout << " n Bad Operator: " << S;
}
return 0;
}

A. 9
B. 3
C. 9 / 3 = 3
D. Bad Operator
E. None of these
Answer» D. Bad Operator


Discussion

No Comment Found

Related MCQs