uses crt; var max, i , n,k2,k : integer; m: array [1..100] of integer; begin randomize; write('vvedi razmer massiva = '); read (n); k:= 0; k2:=0; for i:=1 to n do m[i]:= random (100)+20; for i:=1 to n do if m[i] mod 2 =0 then k:= k+1 else k2:= k2+1; writeln; for i:= 1 to n do write (m[i],' '); writeln; writeln ('chetnii = ',k); writeln ('necetnii = ',k2); readkey; end.
Паскаль
uses crt;
var
max, i , n,k2,k : integer;
m: array [1..100] of integer;
begin
randomize;
write('vvedi razmer massiva = ');
read (n);
k:= 0;
k2:=0;
for i:=1 to n do
m[i]:= random (100)+20;
for i:=1 to n do
if m[i] mod 2 =0 then k:= k+1 else k2:= k2+1;
writeln;
for i:= 1 to n do
write (m[i],' ');
writeln;
writeln ('chetnii = ',k);
writeln ('necetnii = ',k2);
readkey;
end.