Win a copy of Terraform in Action this week in the Cloud forum!

# Ian Paul Budiman

Greenhorn
since Jan 05, 2012
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
1
0
Total given
5
Given in last 30 days
0
Scavenger Hunt Ranch Hand Scavenger Hunt Greenhorn Scavenger Hunt

## Recent posts by Ian Paul Budiman

Thanks Winston, I'll look into it, great tips....
9 years ago
Hi Louise,

I am a newbie also, but the logic solution for that particular is:

You will print out value X, Value Y from X=0, X=1, X=2, X=3, X=4

Which the format would be: "System.out.print(x + "" + y +" "); "

As you know the given parameter is, x = x + 1 and y = x - y

So, it will give you result:

when x=0
0,0(0-0)

when x=1
1,1(1-0)

when x=2
2,1(2-1)

when x=3
3,2(3-1)

when x=4
4,2(4-2)

Which the bold part is "Y"

Hope it helps.
9 years ago
It seems the answer is much more simpler than I thought.

I tried to put all the formula into an equation, and got stuck with "e1.count = e1.count + 1"; and "e2.count = e2.count + e1.count;" which then I got lost where to put e1=e2 in the middle.

Thanks for shedding the light.

The answer is: e1.count = e1.count * 2 + 2

And thanks for the input Fred, it's great, it gives me clearer picture......and I'll save log4j later...as your suggestion. 9 years ago
Thanks Matthew for correcting the post and sorry for double post.

I know the answer is 46, but then I tried to solve it manually using logic, but couldn't find one, especially if your println e1 or e2 with the same result.

Maybe I missed something basic since I completely understand the logic for the answer if the initial condition for both e1 and e2 is "Echo e2 = new Echo();" rather then e2=1 or e1=e2.

Thanks fr dropping by.
9 years ago
Thanks fr the answer on the previous post, sorry for double post.

I know the answer is 46, I try to solve it manually using logic, but couldn't find one, especially if your println e1 or e2 with the same result.

Maybe I missed something basic since I completely understand the logic for the answer if the initial condition for both e1 and e2 is "Echo e2 = new Echo();" rather then e2=1 or e1=e2.

Thanks fr dropping by.
9 years ago
Hi all,

I am a newbie here, and have tried several exercises from Head's First Java, can someone help me with the logic of this:

Where the result is:
helloooo...
helloooo...
helloooo...
helloooo...
helloooo...
46

And I have tried to change the last code to become:
System.out.println(e2.count);

Which resulted the same.

Have examined this for few days but to no avail.

Any help on the logic to get the answer "46" in both cases above mentioned would be much appreciated.

Regards,

[Edit - added code tags - MB]
9 years ago