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

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,


create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file

0 Answers   HCL,


. Write a program using two-dimensional arrays that computes the sum of data in tows and the sum of data in columns of the 3x3 (three by three) array variable n[3][3].

2 Answers   IBM,


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  


what is virtual constroctor ? give an exam for it?-(parimal dhimmar)

2 Answers  






Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.

0 Answers   Facebook, Webyog, Wipro,


Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37

0 Answers   Nagarro,


Min-Max Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and calculate its complexity T(n).

1 Answers   Infosys, Qatar University,


U hv to enter a range from a and b and search hw many no. of times a pattern n. occurs between the range a and b. Eg :i/p:enter range :0 100 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 0 to 100:1 Eg :i/p:enter range :100 1000 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 100 to 1000: (in this 13,113,131,132,133&#8230;139,213,313,&#8230;913 all these will be counted)

0 Answers  


Code for Method of Handling Factorials of Any Size?

0 Answers  


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

0 Answers  


write a program that accepts a number and outputs its equivalent in words. take note that the maximum input is 3000

1 Answers   Alvin,


Categories