题目: |
Program ZX2017p2;
var n, i,b:longint;
a:array[l.. 4] of longint;
begin
readln(n);
for i:=1 to n do
read (b);
if (b>=0) and (b<=18) then a[1]:=a[1]+1;
if (b>=19) and (b<=35) then a[2]:=a[2]+1;
if (b>=36) and (b<=60) then a[3]:=a[3]+1;
if (b>60) then a[4]:=a[4] + 1;
end;
for i:=1 to 4 do
writeln(a[i]/n*100:0:2,'%');
end
输入:
10
1 11 21 31 41 51 61 71 81 91 输出:20.00% 20.00% 20.00% 40.00%
|