moving from gitlab

This commit is contained in:
2026-05-15 13:26:54 -04:00
commit 7391c21087
33 changed files with 2539 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#include <stdio.h>
int main(int argc, char **argv) {
FILE *file = fopen("words.txt", "r");
if (!file) {
fprintf(stderr, "Error opening file");
return -1;
}
char buffer[256];
int lineCount = 0, wordCount = 0;
while (fgets(buffer, sizeof(buffer), file)) {
lineCount++;
if (buffer[0] == '\n')
continue;
for (int i = 0; buffer[i] != '\0'; i++) {
if (buffer[i] == ' ' || buffer[i] == '\n') {
wordCount++;
}
}
}
printf("Number of Lines: %d\n", lineCount);
printf("Number of Words: %d\n", wordCount);
fclose(file);
return 0;
}