No output for loop program

QuestionsNo output for loop program
sethbeckerman5 Staff asked 4 years ago

The scope is to output the numbers from 1 to (input number) with the multiples of 3 being a each. E.g. for 8 as input: 1,2,,4,5,,7,8. I tried to do this with a for loop but it has no output for some reason.

I tried converting the x variable (integer) to a string and then making it the * that should be printed out, in the first half of the IF statement and the last part with the ELSE basically the same.
I also tried to make the for statement like this:

with the x++ at the end but this just game me the result of ,,8. With an input of 7; 8 should not be part of this and I have no idea why it put 8 as an output.


View on Stack Overflow