From c24973af02bc33f2f5f25d37e22ca91da5de3c47 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sat, 4 Jun 2022 12:11:15 +0530 Subject: inital commit --- 1.20.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 1.20.c (limited to '1.20.c') diff --git a/1.20.c b/1.20.c new file mode 100644 index 0000000..2606fa1 --- /dev/null +++ b/1.20.c @@ -0,0 +1,32 @@ +#include + +#define TAB 8 + +int +main(void) +{ + int input, count, space; + + count = 0; + + while ((input = getchar()) != EOF) { + if (input == '\t') { + space = (TAB - (count % TAB)); + + for (space = (TAB - (count % TAB)); space > 0; space--) { + printf(" "); + count++; + } + } + + else if (input == '\n') + count = 0; + + else { + count++; + printf("%c", input); + } + } + + return 0; +} -- cgit v1.2.3