109.3.. Učitiat dvodimenzionalni niz - matricu nxm. Izračunati i ispisati sumu svake kolone niza X[n,m].

Opis programa:

Tekstualni algoritam:

Listing programa:

PROGRAM p10913011;
USES
  WinCrt;
VAR
  i, j, n, m, S : INTEGER;
  X : ARRAY [1..15,1..15] OF INTEGER;
  Skol : ARRAY [1..15] OF INTEGER;
BEGIN
  WRITE('n m =');
  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 j := 1 TO m DO  {suma kolona}
    BEGIN
      Skol[j]:=0;
      FOR i := 1 TO n DO
        Skol[j] := Skol[j] + X[i,j];
      WRITELN('Skol[',j,']=', Skol[j]);
    END;
END.

Izvođenje programa:

Index