Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 10, b = 20, c = 30;
6.
float d;
7.
try
8.
{
9.
if ((a - b) != 0)
10.
{
11.
d = c / (a - b);
12.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 10, b = 20, c = 30;
6.
float d;
7.
try
8.
{
9.
if ((a - b) != 0)
10.
{
11.
d = c / (a - b);
12.
cout
Answer: Option B
Was this answer helpful ?
We are manipulating the values, if there is any infinite value means, it will raise an exception.
Output:
$ g++ gex2.cpp
$ a.out
-3
Was this answer helpful ?
Submit Solution