My professor said we have to write a page about how to trace this
for(int count = 0; count <= 3; count++)
for(int count2 = 0 < count; count2++)
System,out,println(count2)
Can somebody give me a general idea of how to trace this
I know the answer is
0
0
1
0
1
2
but idk how i got it
coco24
0
Light Poster
Recommended Answers
Jump to PostPlay computer with the code. Take a piece of paper and write down the values of the variables as you mentally execute each statement.
For example the first time this statement is executed:
for(int count = 0; count <= 3; count++)
count will have a value of 0Add …
Jump to PostWrite a program that executes the code. Add some more print outs to it, compile it and execute it.
Otherwise do as I suggested above: Get a piece of paper and play computer statement by statement, writing down the values of the variables as they change.
All 7 Replies
NormR1
563
Posting Sage
Team Colleague
coco24
0
Light Poster
NormR1
563
Posting Sage
Team Colleague
coco24
0
Light Poster
NormR1
563
Posting Sage
Team Colleague
tong1
22
Posting Whiz
tong1
22
Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.