Skip to content

Instantly share code, notes, and snippets.

@phc15
Last active February 18, 2021 07:45
Show Gist options
  • Save phc15/0f7f0e903981f953da281bc4a5c3231e to your computer and use it in GitHub Desktop.
Save phc15/0f7f0e903981f953da281bc4a5c3231e to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define COLUMNS 4
int main() {
int c, counter;
counter = 0;
while((c = getchar()) != EOF) {
if(c != '\t') {
putchar(c);
counter++;
}
if(counter == COLUMNS) counter = 0;
if (c == '\t') {
for(int i = 0; i < COLUMNS - (counter % COLUMNS); i++) {
putchar(' ');
}
counter = 0;
}
if( c == '\n') counter = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment