From 3512ae49abfa0487169f53bca7beb317dd9be073 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Tue, 9 Nov 2021 00:20:01 -0500 Subject: [PATCH] Character counting example v2 --- 05-char-counting.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/05-char-counting.c b/05-char-counting.c index ebecc04..1688813 100644 --- a/05-char-counting.c +++ b/05-char-counting.c @@ -2,10 +2,9 @@ int main() { - long nc; + double nc; - nc = 0; - while (getchar() != EOF) - ++nc; - printf("%ld\n", nc); + for (nc = 0; getchar() != EOF; ++nc) + ; + printf("%.0f\n", nc); }