mirror of https://github.com/dirtbags/fluffy.git
New printy command
This commit is contained in:
parent
16ac8bd6ac
commit
fb2cc4c44d
|
@ -0,0 +1,23 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
int c;
|
||||||
|
unsigned int count = 0;
|
||||||
|
unsigned int printy = 0;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
c = getchar();
|
||||||
|
if (EOF == c) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (isprint(c)) {
|
||||||
|
printy += 1;
|
||||||
|
}
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%f\n", printy/(float)count);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue