109.3.. Učitiat dvodimenzionalni niz - matricu nxm. Izračunati i ispisati sumu svakog reda niza X[n,m].
Opis programa:
Tekstualni algoritam:
Listing programa:
PROGRAM p10913010;
USES
WinCrt;
VAR
i, j, n, m, S : INTEGER;
X : ARRAY [1..15,1..15] OF INTEGER;
Sred : ARRAY [1..15] OF INTEGER;
Skol : ARRAY [1..15] OF INTEGER;
BEGIN
WRITE('n m ='); {dimenzije matrice}
READLN(n,m);
WRITELN('Ulaz niza');
FOR i := 1 TO n DO {ulaz}
FOR j := 1 TO m DO
BEGIN
WRITE('X[',i,',',j,']=');
READLN(X[i,j]);
END;
FOR i := 1 TO n DO {izlaz}
BEGIN
WRITELN;
FOR j := 1 TO m DO
WRITE(X[i,j]:4);
END;
WRITELN;
S := 0;
FOR i := 1 TO n DO {suma redova}
BEGIN
Sred[i]:=0;
FOR j := 1 TO m DO
Sred[i] := Sred[i] + X[i,j];
WRITELN('Sred[',i,']=',Sred[i]);
END;
END.
Izvođenje programa:
Index
|
|