if (x >= 25)
{
x - 25; // This accomplishes nothing
y = y + 1;
}
if (x >= 10 && x < 25)
{
x - 10; // This accomplishes nothing
} y = y + 1;
if (x >= 5 && x < 10)
{
x - 5; // This accomplishes nothing
} y = y + 1;
if (x >= 1 && x < 5)
{
x - 1; // This accomplishes nothing
y= y + 1;
}
In each of those lines you're subtracting a number from x
, but you're doing nothing with the result. If you're trying to update x
with the result, you need to do just like you're doing with y
, and put x =
in front of the expression.
So if you want x
to go down by 25
, you should write:
x = x - 25;
Alternatively, you can write the shorthand:
x -= 25; // Note the equal sign