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 | 6 No |
Post New Answer View All Answers
What is this pointer in c plus plus?
How can I swap two values without using a temporary?
What is the purpose of the preprocessor directive error?
Write a c program to demonstrate character and string constants?
Explain how do you override a defined macro?
What are qualifiers in c?
Explain what are binary trees?
In a switch statement, what will happen if a break statement is omitted?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
Write a Program to accept different goods with the number, price and date of purchase and display them
Which header file should you include if you are to develop a function which can accept variable number of arguments?
What are pragmas and what are they good for?
Why static is used in c?
What is the mean of function?
How can I find out how much free space is available on disk?