-
What is the output of this program?
#include <iostream>
using namespace std;
double Div(int num1, int num2)
{
if (num2 == 0)
{
throw "Division by zero condition!";
}
return (num1 / num2);
}
int main ()
{
int p = 25;
int q = 0;
double Res = 0;
try
{
Res = Div(p, q);
cout << Res << endl;
}
catch (const Message)
{
cerr << Message << endl;
}
return 0;
}
-
- Compilation Error
- 25
- Runtime Error
- Division by zero condition!
- None of these
Correct Option: A
As we missed the data type in the catch block, It will arise an error.