learn_c/intro/count_char2.c

12 lines
158 B
C
Raw Normal View History

2023-11-13 18:18:50 +00:00
#include <stdio.h>
/* count characters input; 2nd version */
main()
{
double nc;
for (nc = 0; getchar() != EOF; ++nc)
;
printf("%.0f\n", nc);
}