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

21
arrays.c Normal file
View File

@ -0,0 +1,21 @@
#include <stdio.h>
int main() {
int ch, n_whitesp, n_other;
int n_digit[10] = {0}; /* initialize array with zeroes */
n_whitesp = n_other = 0;
while ((ch = getchar()) != EOF)
if (ch >= '0' && ch <= '9')
++n_digit[ch - '0'];
else if (ch == ' ' || ch == '\n' || ch == '\t')
++n_whitesp;
else
++n_other;
printf("digits = ");
for (int i = 0; i < 10; ++i)
printf(" %d", n_digit[i]);
printf(", white space = %d, other = %d\n", n_whitesp, n_other);
}