aboutsummaryrefslogblamecommitdiff
path: root/1.20.c
blob: 2606fa1ab3a1db6b9f0e94d5ddb2e033d0edfc60 (plain) (tree)































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