Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

the answer is syntax error but if there was a : after default

the execution would be like:
for i=0 case 0 is executed and then since there is no break
statement all the cases including the default case are
executed and the 16 is printed,.then i is iterated using
i++, now i=17 ,it enters the switch statement and only
default case is executed and i=i+5=21 is printed

Is This Answer Correct ?    37 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Should I learn data structures in c or python?

976


What is volatile variable how do you declare it?

1026


What is s in c?

997


5 Write an Algorithm to find the maximum and minimum items in a set of ‘n’ element.

2040


What is the benefit of using const for declaring constants?

990


Explain About fork()?

1058


Explain what is dynamic data structure?

1116


What is ambagious result in C? explain with an example.

2551


What is c programing language?

1043


What are the benefits of c language?

1109


Explain what’s a signal? Explain what do I use signals for?

1053


What are comments and how do you insert it in a C program?

1198


How can I delete a file?

1016


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

1419


What are the different types of constants?

1020