Const nx=30;var i,j,p,n:integer;A:array[1..nx,1..nx] of integer;d,Sn,min:real;begin p:=1;write('Введите размер матрицы');Read(n);for i:=1 to n do beginfor j:=1 to n do beginA[i,j]:=random(3)-2;write(A[i,j]:4);end;writeln;end;writeln;writeln;for i:=1 to n do beginfor j:=1 to n do beginif i = j then begin if A[i,j]<> 0 then p:=p* A[i,j];write(A[i,j]:4);endelse write(' ':4);end;writeln;end;write('p =',p);writeln;writeln;for i:=1 to n do beginfor j:=1 to n do beginif (i= n -j +1) then begin if A[i,j]<> 0 then p:=p* A[i,j];write(A[i,j]:4);endelse write(' ':4);end;writeln;end;write('p =',p);end.
var s : string[50]; i, j, k : word; f : boolean; function isSpace(ch : char) : boolean; begin isSpace := false; if ch = ' ' then isSpace := true; end; begin f := false; repeat j := 0; writeln('введите строку, состоящую из 2 слов'); readln(s); for i := 1 to length(s) do if isSpace(s[i]) then begin inc(j); k := i; end; if j =1 then f := true; until f; write(copy(s, k + 1, length(s)), ' ', copy(s, 1, k - 1)); end. недавно такую писала :)
i, j, k : word;
f : boolean;
function isSpace(ch : char) : boolean;
begin isSpace := false;
if ch = ' ' then isSpace := true;
end;
begin f := false;
repeat j := 0;
writeln('введите строку, состоящую из 2 слов');
readln(s);
for i := 1 to length(s) do
if isSpace(s[i]) then
begin
inc(j);
k := i; end;
if j =1 then f := true;
until f;
write(copy(s, k + 1, length(s)), ' ', copy(s, 1, k - 1));
end.
недавно такую писала :)