Oh! I didn't read the "on the same line" business. Jps is right.
I interpreted the question's "but" as meaning "instead of" - but either reading's possible.
Type: Posts; User: pbrockway2
Oh! I didn't read the "on the same line" business. Jps is right.
I interpreted the question's "but" as meaning "instead of" - but either reading's possible.
It's hard to say what you're doing wrong without seeing the new code ... ;)
But, basically, printing the number should be in the last "else" of the if-elseif-chain. That's because you only what...
You are printing in the right place. The printing has to be inside the loop because you want to print for each number.
But see my previous post and make sure you are really clear avout what has...
Make sure you are clear about what you have to print. Then think about the code: you may well find that you don't need those string variables at all.
for loops are the loops of choice when you...
Yes, I think you're right. Notice that every line will be HiSomething: that's because every number 2->50 is a multiple of at least one of 2,3,5, or 7. and notice that you only print one thing. ...
I'm not sure that the strings are being printed for every number. Check the small numbers. When the problem occurs might give a clue about why.
if (i % 5 == 0);
hiFive = "HiFive";
Don't put a semicolon as part of the if statement like that.
Instead: