for (x = 0; x <= 15; x++)
{
x += 5 - x;
print(x + ", ")
}

x += 5 - x
or
x = x + 5 - x

what is thy answer?
:(

5, 5, 5, 5, 5, 5, 5 repeating :O??
-_- ummmm

Recommended Answers

All 3 Replies

well ... I don't know what print does (I just assume it's a simple System.out.print)
what exactly are you trying to achieve?

oldX = x;
x = x+5;
x = x - oldX;

since the only difference is the + 5, it's quite normal the output will always be 5

I never knew that x += 5 - x
would be equal to: x = x + 5 - x

I recently found out when I got home and search for it.

well, there's your problem :)
so I assume you can solve your problem now?

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.