Exercise #1.5.2 - Character Counting - 2nd Ver

alendr · updated September 15, 2021 · C
#include <stdio.h>/* Count characters as input */ 
int main() {
    double nc; 
    for (nc = 0; getchar() != EOF; ++nc)
        ; 
    
    printf("%.0f\n", nc); 
    return 0;
}

Comments

Please sign up or log in to contribute to the discussion.