first commit!

This commit is contained in:
2025-02-06 12:54:34 +02:00
commit 37f9a3d138
24 changed files with 693 additions and 0 deletions

24
word_count.c Normal file
View File

@ -0,0 +1,24 @@
#include <stdio.h>
#define IN 1
#define OUT 0
int main() {
int character, lines, words, chars, state;
state = OUT;
lines = words = chars = 0;
while ((character = getchar()) != EOF) {
++chars;
if (character == '\n')
++lines;
if (character == ' ' || character == '\n' || character == '\t')
state = OUT;
else if (state == OUT) {
state = IN;
++words;
}
}
printf("\n%d %d %d\n", lines, words, chars);
}