Advertisement
ridjis

5. zad suma po kolonama

Dec 5th, 2013
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MODULE nekevrste;
  2. FROM InOut IMPORT WriteLn, WriteString, WriteCard, ReadCard;
  3. TYPE matra= ARRAY [1..20], [1..20] OF CARDINAL;
  4. VAR m: matra;
  5.     i,j,n,sum: CARDINAL;
  6.     s: ARRAY [1..120] OF CARDINAL;
  7. BEGIN
  8.   WriteString('Unesite dimenziju matrice: ');
  9.   ReadCard(n);
  10.   WriteLn;
  11.   WriteString('Unesite matrice: ');
  12.   WriteLn;
  13.   FOR i:=1 TO n DO
  14.     FOR j:=1 TO n DO
  15.       ReadCard(m[i,j]);
  16.     END;
  17.     WriteLn;
  18.   END;
  19.   WriteString('Stampa matrice: ');
  20.   WriteLn;
  21.   FOR i:=1 TO n DO
  22.     FOR j:=1 TO n DO
  23.       WriteCard(m[i,j],5);
  24.     END;
  25.     WriteLn;
  26.   END;
  27.   FOR i:=1 TO n DO
  28.     FOR j:=1 TO n DO
  29.       s[i]:=s[i]+m[j,i];
  30.     END;
  31.   END;
  32.   WriteLn;
  33.   WriteString('Niz po kolonama izgleda ovako: ');
  34.   FOR i:=1 TO n DO
  35.     WriteCard(s[i],4);
  36.   END;
  37.   WriteLn;
  38.   sum:=0;
  39.   WriteString('Suma niza iznosi:  ');
  40.   FOR i:=1 TO n DO
  41.     sum:=sum+s[i];
  42.   END;
  43.   WriteCard(sum,5);
  44.   WriteLn;
  45. END nekevrste.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement