Accumulate over a File Harder Examples

From Progzoo
Jump to: navigation, search

Average Name Length

What is the average length of Country name (to two decimal places).

[Font] [Default] [Show] [Resize] [History] [Profile]

Benford's Law

Show the distribution of the first digit of the population for countries of the world. Show percentages, be sure to round, ignore countries with population 0.

The output is as shown. Note that 27% of countries have populations that start with the digit 1, only 19% start with a 2 ...

1  27%
2  19%
3  11%
4  12%
5   6%
6   9%
7   6%
8   6%
9   3%
[Font] [Default] [Show] [Resize] [History] [Profile]