mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-06-07 14:31:23 +00:00
ddb82cb2e0
Maybe someday I'll become adept at using cvs...
18 lines
397 B
Plaintext
18 lines
397 B
Plaintext
# histogram
|
|
# input: numbers between 0 and 100
|
|
# output: histogram of deciles
|
|
|
|
{ x[int($1/10)]++ }
|
|
|
|
END { for (i = 0; i < 10; i++)
|
|
printf(" %2d - %2d: %3d %s\n",
|
|
10*i, 10*i+9, x[i], rep(x[i],"*"))
|
|
printf("100: %3d %s\n", x[10], rep(x[10],"*"))
|
|
}
|
|
|
|
function rep(n,s, t) { # return string of n s's
|
|
while (n-- > 0)
|
|
t = t s
|
|
return t
|
|
}
|