This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!See this thread for details.
Big Moose Saloon
 Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login Win a copy of Refactoring for Software Design Smells: Managing Technical Debt this week in the OO, Patterns, UML and Refactoring forum!

# Flow Control -JQ+

Arun Pai
Ranch Hand

Joined: Mar 11, 2002
Posts: 143

I don't seem to understand how the output is 10. Please advise.
-Arun
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
Arun, I'll explain step by step:
i j k c (k>j)
0 0 0 1 false
0 0 1 2 true
0 1 0 3 false
0 1 1 4 false
0 1 2 5 true
1 0 0 6 false
1 0 1 7 true
1 1 0 8 false
1 1 1 9 false
1 1 2 10 true

Regards,
Jamal Hasanov
www.j-think.com
Arun Pai
Ranch Hand

Joined: Mar 11, 2002
Posts: 143
Hi Jamal,
Really fast and the solution is quite simple.Thanks a lot.
-Arun
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
These are the values when i is 0:
c=0
i=0
j=0
k=0
c=1
k=1
c=2
j=1
k=0
c=3
k=1
c=4
k=2
c=5
i=1
now i is 1 and the same it's repeated again,
but c is increamented up to 10

Arun Pai
Ranch Hand

Joined: Mar 11, 2002
Posts: 143
Jose,
Thanks and what is this???
Well, I have been good looking for a long time before Map noticing it.
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
By the way, Arun
try this method in exam: draw a table of variables(for example: variables are columns) and debug code step by step in paper.
This method helped me very much in exam.
Regards,
Jamal Hasanov
www.j-think.com
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Arun it's a joke about how good looking some bartenders are.
It was no addressed to anybody.
I think it is time to remove it

I agree. Here's the link: http://aspose.com/file-tools

subject: Flow Control -JQ+