3 is the answer . do being exit controlled loop , x is incremented to 2 and then checked for condition which happens to be false here (2>2) So t is incremented only 3 times.
On Mon, Aug 15, 2011 at 12:44 AM, aditi garg <[email protected]>wrote: > 3 > > On Mon, Aug 15, 2011 at 12:38 AM, Adi Srikanth <[email protected]>wrote: > >> int main() >> { >> int x=0,t=0; >> >> switch(x) >> { >> case 0: x++; >> do { >> >> case 1:t++; >> case 2:t++; >> case 3:t++; >> >> >> x++; >> } while(x>2); >> >> >> >> >> } >> printf("%d\n",t); >> return 0; >> >> } >> >> >> t will be wat???...3, 6 or 9 >> >> Regards, >> Srikanth. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Aditi Garg > Undergraduate Student > Electronics & Communication Divison > NETAJI SUBHAS INSTITUTE OF TECHNOLOGY > Sector 3, Dwarka > New Delhi > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards Rajeev N B <http://www.opensourcemania.co.cc> "*Winners Don't do Different things , they do things Differently"* -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
