1)program pr;
var
a: array [1..100] of integer;
i, temp,n, j: integer;
begin
writeln('Введите размер массива');
readln(n);
for i := 1 to n do
begin
a[i] := random(100, 999);
write(a[i]:4);
end;
for i := 1 to n do
for j := 1 to n - i do
if ((a[j] div 10) mod 10) > ((a[j + 1] div 10) mod 10) then
begin
temp := a[j];
a[j] := a[j + 1];
a[j + 1] := temp;
end;
writeln;
for i := 1 to n do
write(a[i]:4);
end.
2)var a: array [1..5] of integer; i, amount: integer;
begin
read(a[1], a[2], a[3], a[4], a[5]);
amount := 0;
for i := 1 to 5 do
begin
while a[i] >= 10 do
begin
a[i] := a[i] div 10;
end;
if a[i] = 8
then
amount := amount + 1;
end;
writeln(amount);
end.
3)var i, c1, c2, k: integer;
stroka, slovo: string;
begin
write ('stroka=');
readln(stroka);
k:=0;
stroka:=stroka+' ';
c1:=1;
c2:=1;
for i:=2 to length (stroka) do
if stroka[i] = ' ' then
begin
c2:=i;
slovo:=copy (stroka, c1, c2-c1);
if slovo[length(slovo)]=slovo[1] then
begin
inc (k);
write (slovo,' ');
end;
c1:=c2+1;
end;
writeln;
writeln ('всего слов = ', k) ;
end.