aboutsummaryrefslogtreecommitdiff
path: root/1.22.c
diff options
context:
space:
mode:
authorsinanmohd <pcmsinan@gmail.com>2022-06-04 12:11:15 +0530
committersinanmohd <pcmsinan@gmail.com>2022-06-04 12:11:15 +0530
commitc24973af02bc33f2f5f25d37e22ca91da5de3c47 (patch)
tree460a005b6a3a9a967bd881bc2bf01e0becbe33cc /1.22.c
inital commit
Diffstat (limited to '1.22.c')
-rw-r--r--1.22.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/1.22.c b/1.22.c
new file mode 100644
index 0000000..12d7784
--- /dev/null
+++ b/1.22.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+
+#define LINE_LENGTH 230
+#define TAB 8
+
+int
+main(void)
+{
+ int count;
+ char input;
+
+ count = 0;
+
+ while ((input = getchar()) != EOF) {
+ if (input == '\n')
+ count = 0;
+ else if (input == '\t')
+ count = count + TAB;
+ else
+ count++;
+
+ printf("%c", input);
+
+ if (count >= LINE_LENGTH) {
+ printf("\n");
+ count = 0;
+ }
+ }
+
+ return 0;
+}