• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Flow Control.......

 
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Options :
1)2
2)3
3)6
4)7
5)9
I tried running the code and got the output as 3.
Can any one make me understand the flow of the code?
Sonir
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sonir :
write it this way
i=0;j=0;k=0 counter will be 0(1)
i=0;j=0;k=1 break's out
i=1;j=0;k=0 counter will be 1(2)
i=1;j=0;k=1 break's out
i=1;j=0;k=0 counter will be 2(3)
i=1;j=0;k=1 break's out
i=2;j=0;k=0 counter will be 3(4)
i=2;j=0;k=1 break's out
So the answer 3 will be printed.
Hope this helps
-A
 
Ranch Hand
Posts: 417
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first ......i=0 j=0 k=0, counter =1
second ........... k=1, break middle and enter outer
third ...... i=1 j=0 k=0 counter =2
fourth ........... k=1 break middle and enter outer
fifth i=2 j=0 k=0 counter =3
......... k=1 break middle and enter outer
and it stops as i cannot be incremented further.
hope this helps....


Options :
1)2
2)3
3)6
4)7
5)9
I tried running the code and got the output as 3.
Can any one make me understand the flow of the code?
Sonir[/qb]<hr></blockquote>
[ January 23, 2002: Message edited by: mark stone ]
 
Seriously Rick? Seriously? You might as well just read this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!