From 0c5c723aaa0e9e844f69b995503b823e3f50ae45 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Wed, 17 Nov 2021 21:45:17 +0800 Subject: 1.10 --- 1/10.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 1/10.c (limited to '1/10.c') diff --git a/1/10.c b/1/10.c new file mode 100644 index 0000000..9774fe3 --- /dev/null +++ b/1/10.c @@ -0,0 +1,19 @@ +#include + +/* replaces tab with \t, backspace with \b and backslash with \\ */ +int main(int argc, char *argv[]) { + int c; + + while ((c = getchar()) != EOF) { + if (c == '\t') + printf("\\t"); + else if (c == '\b') + printf("\\b"); + else if (c == '\\') + printf("\\\\"); + else + printf("%c", c); + } + + return 0; +} \ No newline at end of file -- cgit v1.2.3