Result of the following program is
main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i)
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default i+=4;
break;}
printf("%d,",i);
}
}
a)0,5,9,13,17
b)5,9,13,17
c)12,17,22
d)16,21
e)syntax error
Answer Posted / sankar
Answer is (e) Option : Syntax error
void main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i)
case 0:i+=5; // this is illegal
case 1:i+=2; // this is illegal
case 5:i+=5; // this is illegal
default i+=4; // Colon is missing
break;
}
printf("%d,",i);
}
} // This is extra braces
| Is This Answer Correct ? | 4 Yes | 8 No |
Post New Answer View All Answers
Tell me what is the purpose of 'register' keyword in c language?
What is a stream?
What is wrong in this statement?
differentiate built-in functions and user – defined functions.
Do pointers need to be initialized?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
Explain how can I prevent another program from modifying part of a file that I am modifying?
Explain what is wrong with this program statement?
What is the best way to store flag values in a program?
What is union and structure in c?
What kind of structure is a house?
Is c# a good language?
Differentiate between ordinary variable and pointer in c.
What are header files and what are its uses in C programming?
Are there constructors in c?