Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*Napisati program koji ucitava prirodan broj n(3<= n <=20)
- i celobrojnu matricu A formata n*n.
- Formirati matricu B dimenzija (n-1)*(n-1) koja nastaje uklanjanjem prve vrste
- i poslednje kolone matrice A.
- Program treba da ispise matricu B i sumu elemenata prve vrste matrice B.*)
- MODULE nun1;
- FROM InOut IMPORT WriteString, WriteLn, WriteInt, ReadInt;
- TYPE MATRICA=ARRAY [1..20],[1..20] OF INTEGER;
- VAR n,i,j,sum: INTEGER;
- A,B:MATRICA;
- BEGIN
- WriteString('Unesite n za dimenziju matrice: ');
- ReadInt(n);
- WriteLn;
- (*UNOS*)
- FOR i:=1 TO n DO
- FOR j:=1 TO n DO
- WriteString('Unesite ');
- WriteInt(i,1);
- WriteString('. vrstu i ');
- WriteInt(j,1);
- WriteString('. kolonu matrice: ');
- ReadInt(A[i,j]);
- END;
- END;
- (*ISPIS*)
- WriteString('Matrica izgleda ovako: ');
- WriteLn;
- FOR i:=1 TO n DO
- FOR j:=1 TO n DO
- WriteInt(A[i,j],5);
- END;
- WriteLn;
- END;
- (*PRENOS U B*)
- FOR i:=2 TO n DO
- FOR j:=1 TO n-1 DO
- B[i,j]:=A[i,j];
- END;
- END;
- (*ISPIS B*)
- WriteString('Matrica B izgleda ovako: ');
- WriteLn;
- FOR i:=2 TO n DO
- FOR j:=1 TO n-1 DO
- WriteInt(B[i,j],5);
- END;
- WriteLn;
- END;
- (*RACUNANjE 1. VRSTE B MAT*)
- FOR i:=2 TO 2 DO
- FOR j:=1 TO n-1 DO
- sum:=sum + B[i,j];
- END;
- WriteLn;
- END;
- (*ISPIS SUME*)
- WriteString('Suma elemenata prve vrste B matrice je: ');
- WriteInt(sum,0);
- WriteLn;
- END nun1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement