109.1.. Učitati dva dvodimenzionalna niza i formirati treći čiji je opšti član: cij = xij + yij/2.
Opis programa:
Tekstualni algoritam:
Listing programa:
PROGRAM p10912104;
USES
WinCrt;
VAR
i,j, n, m : INTEGER;
X, y, C : ARRAY [1..15,1..15] OF REAL;
BEGIN
WRITE('n m ='); {dimenzije matrice}
READLN(n,m);
WRITELN('Matrica X');
FOR i := 1 TO n DO {ulaz X[i,j]}
FOR j := 1 TO m DO
BEGIN
WRITE('X[',i,',',j,']=');
READLN(X[i,j]);
END;
WRITELN('Matrica Y');
FOR i := 1 TO n DO {ulaz Y[i,j]}
FOR j := 1 TO m DO
BEGIN
WRITE('Y[',i,',',j,']=');
READLN(Y[i,j]);
END;
FOR i := 1 TO n DO {formiranje niza}
FOR j := 1 TO m DO
C[i,j] := X[i,j] + Y[i,j]/2;
WRITELN('Izlaz matrica X');
FOR i := 1 TO n DO {izlaz}
BEGIN
FOR j := 1 TO m DO
WRITE(X[i,j]:4);
WRITELN;
END;
WRITELN('Izlaz matrica Y');
FOR i := 1 TO n DO {izlaz}
BEGIN
FOR j := 1 TO m DO
WRITE(Y[i,j]:4);
WRITELN;
END;
WRITELN('Izlaz matrica C');
FOR i := 1 TO n DO {izlaz}
BEGIN
FOR j := 1 TO m DO
WRITE(C[i,j]:4);
WRITELN;
END;
END.
Izvođenje programa:
Index
|
|