What will be the output-
for(i=1;i<=3;i++)
{
printf("%d",i);
continue;
i++;
}

Answers were Sorted based on User's Feedback



What will be the output- for(i=1;i<=3;i++) { printf("%d",i); ..

Answer / gourab

the o/p will be 123

bcz after printing 1 for d first time then continue will
take to the for statement.thus i will take value 3.and i++
after d continue statement will never get executed,but it
will not give an error.

Is This Answer Correct ?    32 Yes 2 No

What will be the output- for(i=1;i<=3;i++) { printf("%d",i); ..

Answer / chetan

This will not result in a Compiler-error, because "Unreachable-code" is a warning in C, not a compilation error.

The output will be:
123

Is This Answer Correct ?    6 Yes 2 No

What will be the output- for(i=1;i<=3;i++) { printf("%d",i); ..

Answer / harshit

This will result in compiler error as the code i++; inside
the for loop is not reachable.

If continue statement is enclosed within an if construct
then only the program will compile.

Is This Answer Correct ?    14 Yes 13 No

What will be the output- for(i=1;i<=3;i++) { printf("%d",i); ..

Answer / mehtaashish

It will results in a compile time error, stating that
unreachable code for the second increment statement(i++) after
continue statement.

Is This Answer Correct ?    11 Yes 10 No

What will be the output- for(i=1;i<=3;i++) { printf("%d",i); ..

Answer / sakshi arora

The output will be : 123
bcozZ unreachable code is a warning in c , not a compilation error..

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C++ Code Interview Questions

How to Split Strings with Regex in Managed C++ Applications?

0 Answers   Microsoft,


Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++

0 Answers  


solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)

0 Answers  


write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.

0 Answers   HCL, SRCASW,


Hello, I am trying to write a program in c++ which accepts month and year from the user and prints the calender. So please tell me the algorithm and what is the calender logic.

0 Answers  






write a c program, using for loop, that accepts and odds two numbers. The output must be the sum and the addens. This should be repeated 5 times while the first number is decremented by one and the second number is incremented by 1.

2 Answers   IBM, Infosys,


i don't know about working of nested for loop can any one help me

0 Answers  


Complexity T(n) Write a linear-time algorithm that sorts n distinct integers, each of which is between 1 and 500. Hint: Use a 500-element array. (Linear-time means your algorithm runs in time c*n + b, where c and b are any constants that do not depend on n. For example, your algorithm can run in time n, or time 2n + 1, or time 5n + 10, or time 100n + 6, but not time c*n*n = c*n?.)

1 Answers   Qatar University,


write a program that calculate the volume of cylinder after user enters radius and height and show the algorithm used

1 Answers   Jomo Kenyatta University,


1. Write a program using one dimensional array that calculates the sum and average of the five input values from the keyboard and prints the calculated sum and average.

2 Answers  


Write a program to enter 10 number of integer entries into an array n and then odds up all the odd entries. the program then displays the result. plssss answer assss fast asss u can...

1 Answers  


write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation

0 Answers   HCL,


Categories