fluffy

Network Archaeology tools for Unix
git clone https://git.woozle.org/neale/fluffy.git

Neale Pickett  ·  2023-11-15

printy.c

 1#include <stdio.h>
 2#include <ctype.h>
 3
 4int main(int argc, char *argv[]) {
 5    int c;
 6    unsigned int count = 0;
 7    unsigned int printy = 0;
 8
 9    for (;;) {
10        c = getchar();
11        if (EOF == c) {
12            break;
13        }
14        if (isprint(c)) {
15            printy += 1;
16        }
17        count += 1;
18    }
19
20    printf("%f\n", printy/(float)count);
21
22    return 0;
23}