школьный уровень!Срочно!
Найти сумму элементов каждой строки массива A[1..n,1..m] и максимальный элемент 2-ой строки
const n = 100;
m = 100;
var A: array[1..n,1..m] of integer;
max,i,j,s: integer;
begin
randomize;
for i := 1 to n do begin
s := 0;
for j := 1 to m do begin
s := s + A[i,j];
end;
write('Summa elementov stroki ', i);
writeln(' ravna ', s);
max := 1;
for i := 1 to m do begin
if (A[2,i] > A[2,max]) then max := i;
writeln('Max element 2 stroki raven', A[max]);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const n = 100;
m = 100;
var A: array[1..n,1..m] of integer;
max,i,j,s: integer;
begin
randomize;
for i := 1 to n do begin
s := 0;
for j := 1 to m do begin
s := s + A[i,j];
end;
write('Summa elementov stroki ', i);
writeln(' ravna ', s);
end;
max := 1;
for i := 1 to m do begin
if (A[2,i] > A[2,max]) then max := i;
end;
writeln('Max element 2 stroki raven', A[max]);
end.
Var a: array[1..n,1..m] of integer;
i,n,m,max,s: integer;
Begin
Read (n,m);
S:=0;
Max:=0;
For i:=1 to n do
Begin
S:=s+a[i];
End;
For i:=1 to m do
Begin
If (max>a[i]) then
Max:=max
Else max:=a[i];
End;
Write (s);
Write (max);
End.