________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of titli_juit Sent: Tuesday, November 13, 2007 9:33 AM To: [email protected] Subject: [c-prog] please help Hi, Initially i is 0 and hence in switch case statement, it hits case 0 a nd in the second loop it is 17 and hence it hits default which is 17 +4 = 21. To avoid this we have to use break statements in each and every case statements. #include<stdio.h> int main() { int i=0; for(i=0;i<20;i++) { switch(i){ case 0:i+=5; i=5 case 1:i+=2; i=7 case 5:i+=5; i=12 default : i+=4; i=16, i = 17+4= 21 break;} printf("%d,",i); 16 , 21 i=17 } return 0; } the output is 16,21 can you please explain how am i getting this output? [Non-text portions of this message have been removed]
