A couple of things could be causing that % sign to appear:
Your program outputs k without a new line, and your shell prompt just looks like this:
%
Meaning that you run the program like so:
% ./a.out
k //getchar
k% //putchar + exit + shell prompt
So in short: the % isn’t part of the output.
There is of course the problem with your code triggering UB: the implicit int return type is no longer part of the C standard since C99 and up, and your main function is not quite right, some standard compliant main functions are:
int main(void);
int main (int argc, char **argv);
int main (int argc, char *argv[]);
using () is not the same thing.
Lastly, you’re not returning anything from main, which you should do, just add return 0 at the end.
0
solved Why is putchar() printing out the char with the “%” symbol?