5 int c
, i
, j
, nwhite
, nother
, maxnum
;
10 for(i
= 0; i
< 10; i
++)
13 while ((c
= getchar()) != EOF
)
14 if(c
>= '0' && c
<= '9')
16 else if (c
== ' ' || c
== '\n' || c
== '\t')
21 /* print out histogram */
23 for(i
= 0; i
<= 10; ++i
)
25 if(ndigit
[i
] > maxnum
) { maxnum
= ndigit
[i
]; }
28 for(i
= 0; i
< maxnum
; ++i
) // one row for each instance of number
30 printf("%d\t|", maxnum
-i
); // print sidebar
31 for(j
= 0; j
<= 10; ++j
) // one column for each number
33 if(ndigit
[j
] >= maxnum
-i
) { putchar('*'); } else { putchar(' '); }
38 printf("\t 0123456789\n");