Первое :
var
i, num, nums2, nums3, nums4, nums5: Integer;
begin
for i := 1 to 20 do
ReadLn(num);
if num = 2 then
nums2 := nums2 + 1
else if num = 3 then
nums3 := nums3 + 1
else if num = 4 then
nums4 := nums4 + 1
else if num = 5 then
nums5 := nums5 + 1 ;
end;
WriteLn('Количество двоек - ', nums2);
WriteLn('Количество троек - ', nums3);
WriteLn('Количество четвёрок - ', nums4);
WriteLn('Количество пятёрок - ', nums5);
end.
Второе:
i, height, minHeight, maxHeight: Integer;
totalHeight: Real;
ReadLn(height);
if (i = 1) or (height < minHeight) then
minHeight := height ;
if (i = 1) or (height > maxHeight) then
maxHeight := height ;
totalHeight := totalHeight + height;
WriteLn('Максимальный рост - ', maxHeight);
WriteLn('Минимальный рост - ', minHeight);
WriteLn('Средний рост - ', Round(totalHeight / 20.0))
Объяснение:
const
nm=100;
a: array[1..nm] of integer;
i,k,l,n,buf: integer;
randomize;
write('vvedite n ');
readln(n);
writeln('ishodniy massiv:');
for i:=1 to n do
a[i]:=random(99)+1;
write(a[i],' ');
writeln;
write('vvedite k,l (k<l) : ');
readln(k,l);
for i:=k to (l-k)div 2+k do
buf:=a[k];
a[k]:=a[l];
a[l]:=buf;
k:=k+1;
l:=l-1;
for i:=1 to n do write(a[i],' ');
readln;
a,b: array[1..nm] of integer;
i,n: integer;
write('vvedite n>10 ');
writeln('ishodniy massiv a:');
if i<=10 then b[i]:=a[i]+i
else b[i]:=a[i]-i;
writeln('massiv b:');
for i:=1 to n do write(b[i],' ');
Первое :
var
i, num, nums2, nums3, nums4, nums5: Integer;
begin
for i := 1 to 20 do
begin
ReadLn(num);
if num = 2 then
nums2 := nums2 + 1
else if num = 3 then
nums3 := nums3 + 1
else if num = 4 then
nums4 := nums4 + 1
else if num = 5 then
nums5 := nums5 + 1 ;
end;
WriteLn('Количество двоек - ', nums2);
WriteLn('Количество троек - ', nums3);
WriteLn('Количество четвёрок - ', nums4);
WriteLn('Количество пятёрок - ', nums5);
end.
Второе:
var
i, height, minHeight, maxHeight: Integer;
totalHeight: Real;
begin
for i := 1 to 20 do
begin
ReadLn(height);
if (i = 1) or (height < minHeight) then
minHeight := height ;
if (i = 1) or (height > maxHeight) then
maxHeight := height ;
totalHeight := totalHeight + height;
end;
WriteLn('Максимальный рост - ', maxHeight);
WriteLn('Минимальный рост - ', minHeight);
WriteLn('Средний рост - ', Round(totalHeight / 20.0))
end.
Объяснение:
const
nm=100;
var
a: array[1..nm] of integer;
i,k,l,n,buf: integer;
begin
randomize;
write('vvedite n ');
readln(n);
writeln('ishodniy massiv:');
for i:=1 to n do
begin
a[i]:=random(99)+1;
write(a[i],' ');
end;
writeln;
write('vvedite k,l (k<l) : ');
readln(k,l);
for i:=k to (l-k)div 2+k do
begin
buf:=a[k];
a[k]:=a[l];
a[l]:=buf;
k:=k+1;
l:=l-1;
end;
for i:=1 to n do write(a[i],' ');
readln;
end.
const
nm=100;
var
a,b: array[1..nm] of integer;
i,n: integer;
begin
randomize;
write('vvedite n>10 ');
readln(n);
writeln('ishodniy massiv a:');
for i:=1 to n do
begin
a[i]:=random(99)+1;
write(a[i],' ');
end;
writeln;
for i:=1 to n do
if i<=10 then b[i]:=a[i]+i
else b[i]:=a[i]-i;
writeln('massiv b:');
for i:=1 to n do write(b[i],' ');
readln;
end.