Дан двумерный массив. Определить:
а) Сумму всех элементов третьей строки массива;
б) Сумму всех элементов s-го столбца массива.

Ответы

Ответ дал: allangarsk
1
const nx=20;var i,j,n,Sk,St,s:integer; D:array[1..nx,1..nx] of integer;
begin
write('Введите размер матрицы n');Readln(n);write('Введите № столбца s');Readln(s);
if s > n then s:= n;
for i:=1 to n do begin
for j:=1 to n do begin
D[i,j]:= random(100)-50;
write(D[i,j]:4);if i=3 then Sk:= Sk + D[i,j];
if j=s then St:= St + D[i,j];end;
writeln;end;writeln;
write('Sk=',Sk:5,'   St=',St:5);
end.
Вас заинтересует