-
What is the output of this program?
#include <iostream>
using namespace std;
void Sequence(int StopN)
{
int N;
N = 3;
while (true)
{
if (N >= StopN)
throw N;
cout << N << endl;
N++;
}
}
int main(void)
{
try
{
Sequence(4);
}
catch(int ExN)
{
cout << "exception: " << ExN << endl;
}
return 0;
}
-
- 3
exception: 4 - exception: 4
- 3
- exception: 4
3 - None of these
- 3
Correct Option: A
In this program, We are printing one and raising a exception at 4.