Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODULE provr;
- FROM InOut IMPORT WriteLn, WriteString, WriteCard, ReadCard;
- FROM RealInOut IMPORT WriteReal;
- TYPE matra= ARRAY [1..20], [1..20] OF CARDINAL;
- VAR m: matra;
- i,j,n,g,sum: CARDINAL;
- avg: REAL;
- s: ARRAY [1..20] OF CARDINAL;
- BEGIN
- WriteString('Unesite dimenziju matrice po vrstama: ');
- ReadCard(n);
- WriteLn;
- WriteString('Unesite dimenziju matrice po kolonama: ');
- ReadCard(g);
- WriteLn;
- WriteString('Unesite matrice: ');
- WriteLn;
- FOR i:=1 TO n DO
- FOR j:=1 TO g DO
- ReadCard(m[i,j]);
- END;
- WriteLn;
- END;
- WriteString('Stampa matrice: ');
- WriteLn;
- FOR i:=1 TO n DO
- FOR j:=1 TO g DO
- WriteCard(m[i,j],5);
- END;
- WriteLn;
- END;
- sum:=0;
- FOR i:=1 TO n DO
- FOR j:=1 TO g DO
- sum:=sum+m[i,j];
- END;
- END;
- WriteString('Suma elemenata matrice je: ');
- WriteCard(sum,0);
- WriteLn;
- avg:=FLOAT(sum) / (FLOAT(n)*FLOAT(g));
- WriteString('Prosjecna vrednost elemenata matrice je: ');
- WriteReal(avg,0);
- WriteLn;
- END provr.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement