109.3.. Učitati dvodimenzionalni niz - matricu nxm. Naći i ispisati najveći elemenat prvog, drugog i trećeg reda niza X[n,m]
Opis programa:
Tekstualni algoritam:
Listing programa:
PROGRAM p10917006; USES WinCrt; VAR i,j, n, m, max : INTEGER; X : ARRAY [1..15,1..15] OF INTEGER; BEGIN WRITE('n m ='); {dimenzije matrice} 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; max := X[1,1]; FOR i := 1 TO 3 DO {prva 3 reda} IF max < X[i,j] THEN max := X[i,j]; WRITELN('Najveci element 1,2,3 reda matrice =', max); END.
Izvođenje programa:
Index
|
|