aboutsummaryrefslogtreecommitdiff
path: root/1.20.c
blob: 2606fa1ab3a1db6b9f0e94d5ddb2e033d0edfc60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>

#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;
}