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 / vinod

int 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);
}
}

For the above program the output would be 16 and 21

Is This Answer Correct ?    35 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How macro execution is faster than function ?

673


What functions are used for dynamic memory allocation in c language?

604


How can you tell whether a program was compiled using c versus c++?

622


Discuss the function of conditional operator, size of operator and comma operator with examples.

682


Mention four important string handling functions in c languages .

634






How can I implement sets or arrays of bits?

609


What is the purpose of the statement: strcat (S2, S1)?

643


The file stdio.h, what does it contain?

670


What is a #include preprocessor?

622


Why c is faster than c++?

637


What is derived datatype in c?

639


A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?

1516


about c language

1608


Explain how to reverse singly link list.

611


What do you know about the use of bit field?

614