Last active
February 18, 2021 07:45
-
-
Save phc15/0f7f0e903981f953da281bc4a5c3231e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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