-
What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int n1 = 20, n2 = 30, n3 = 60;
float Res;
try
{
if ((n1 - n2) != 0)
{
Res = n3 / (n1 - n2);
cout << Res;
}
else
{
throw(n1 - n2);
}
}
catch (int k)
{
cout<<"Answer is infinite..."<< k;
}
}
-
- 20
- 30
- 60
- -6
- None of these
Correct Option: D
We are manipulating the values, if there is any infinite value means, it will raise an exception.