Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int i;
enum month
{
JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
};
for (i = MAR; i <= NOV; i++)
cout << i;
return 0;
}

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int i;
enum month
{
JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
};
for (i = MAR; i <= NOV; i++)
cout << i;
return 0;
}
a) 01234567891011
b) 123456789101112
c) 34567891011
d) 123456789

Answer: c
Explanation: We are getting the values from march to november and printing its concern number.

Join The Discussion