uses crt;
var a:array[1..100,1..100]of integer;
i,j,n,m,dem,ln,lnc,dem1,k,x,cp:integer;
b,c:array[1..100]of integer;
begin
clrscr;
write('nhap so hang: '); readln(n);
write('nhap so cot:'); readln(m);
for i:=1 to n do
for j:=1 to m do
begin
write('a[',i,',',j,']='); readln(a[i,j]);
end;
writeln('cac so thoa man dieu kien la: ');
{----------------------lon-nhat-hang--------------------}
write('-lon nhat hang: ');
for i:=1 to n do
begin
ln:=a[i,1];
for j:=1 to m do
if ln<=a[i,j] then ln:=a[i,j];
if trunc(sqrt(ln))=sqrt(ln) then write(ln:4);
end;
{---------------------lon-nhat-cot-----------------------}
writeln;
write('-lon nhat cot: ');
for j:=1 to m do
begin
lnc:=a[1,j];
for i:=1 to n do
if lnc<=a[i,j] then lnc:=a[i,j];
if trunc(sqrt(lnc))=sqrt(lnc) then write(lnc:4);
end;
readln;
end.
uses crt;
var a:array[1..100,1..100]of integer;
i,j,n,m,dem,ln,lnc,dem1,k,x,cp:integer;
b,c:array[1..100]of integer;
begin
clrscr;
write('nhap so hang: '); readln(n);
write('nhap so cot:'); readln(m);
for i:=1 to n do
for j:=1 to m do
begin
write('a[',i,',',j,']='); readln(a[i,j]);
end;
writeln('cac so thoa man dieu kien la: ');
{----------------------lon-nhat-hang--------------------}
write('-lon nhat hang: ');
for i:=1 to n do
begin
ln:=a[i,1];
for j:=1 to m do
if ln<=a[i,j] then ln:=a[i,j];
if trunc(sqrt(ln))=sqrt(ln) then write(ln:4);
end;
{---------------------lon-nhat-cot-----------------------}
writeln;
write('-lon nhat cot: ');
for j:=1 to m do
begin
lnc:=a[1,j];
for i:=1 to n do
if lnc<=a[i,j] then lnc:=a[i,j];
if trunc(sqrt(lnc))=sqrt(lnc) then write(lnc:4);
end;
readln;
end.