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

the answer is syntax error
main()// no return type there will be warning
{
int i=0;
for(i=0;i<20;i++)
{
switch(i)// there no starting braces
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default i+=4;//illegal default
statement should end with : i.e.,default:
break;}
printf("%d,",i);
}
}

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of macro formats?

613


Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers

1427


Are pointers integer?

554


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2124


How can you determine the maximum value that a numeric variable can hold?

643






What are the main characteristics of c language describe the structure of ac program?

616


What library is sizeof in c?

576


Why clrscr is used after variable declaration?

1045


In C language what is a 'dangling pointer'?

644


What is difference between main and void main?

630


Why void main is used in c?

564


Differentiate between calloc and malloc.

762


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3251


How to set file pointer to beginning c?

673


What does node * mean?

716