zsh prints a %
(by default for a normal user) when the last line does not end with a newline character. This partial line could be erased by the prompt otherwise. Add a newline to properly terminate the last line (\n
):
printf("1\n");
http://zsh.sourceforge.net/Doc/Release/Options.html#index-PROMPT_005fSP