This repository has been archived on 2020-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stupid-coding-files/charray.c
2020-12-08 09:40:09 +02:00

28 lines
507 B
C

#include <stdio.h>
main () {
int c, i, nwhite, nother;
int ndigit[10];
nwhite = nother = 0;
for (i=0; i<10; i++)
ndigit[i]=0;
while ((c = getchar()) != EOF);
{
if (c >= '0' && c <='9')
++ndigit[c-0]; /* Subtract the first element of the array, show only difference*/
else if (c == ' ' || c == '\n' || c == '\t')
{
++nwhite;
}
else
{
++nother;
}
}
}