In C you need to add another “\” to your code like this.
#include <stdio.h>
main() {
printf("\\n");
}
For Python you can use repr
>>> string = "\n"
>>> print(repr(string))
'\n'
6
solved How do I print the characters “\n” instead of whitespace using python and C? [duplicate]