Do the test before you print the character.
Still having a problem. Heres how I tried to change the code:
I even tried starting a x=0 in the for loop with the same conditional for the if loopCode:printf("%c", sequence[0]) ; for(x = 1; x<strlen(sequence) ; ++x) // print 60 letters per line. { if((x%60 == 0) && (x != 0)) { printf("\n") ; } else { printf("%c", sequence[x]) ; } }
And you added an else clause why? Now sequence[60], sequence[120], etc will never print.
Thank you tabstop for the help. Everything works fine. Sorry for the frustration. I must reiterate that I am barely a novice to programming.
Let's stop and think for a moment. Here's how the loop goes:
If the index is no dividable by 60, so for index 0, print the current character.
Loop.
Same for index 1 though 59.
Coming back on index 60. Print newline. Loop.
Index 61, print character, loop.
Do you see the problem?