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

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  


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,


Write an algorithm that receives a string and reverses it.

2 Answers  


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

0 Answers   Facebook, Webyog, Wipro,


write a program in c++ to scramble a bmp image file using a scramble key 0x7c and an XOR logic. print out the original image, the scrambled image and the program. Note: the first 24bytes of a bmp file contain the header information of the file.

1 Answers  






#include<stdio.h> #include<conio.h> void main() { char str[10]; int,a,x,sw=0; clrscr(); printf("Enter a string:"); gets(str); for(x=0;x<=a;a++); for(x=0;x<=a;x++) { if(str[x]==str[a-1-x]) { sw=1; } else sw=0; } if(sw==10 printf("The entered string is palindrome:"); else printf("The entered string is not a palindrome:); } getch(); } wht would be the explanation with this written code???

2 Answers  


how to diplay a external image of output on winxp by using c & c++,

0 Answers  


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  


1+1/2!+1/3!+...+1/n!

0 Answers  


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,


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,


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