109.3.. Učitati dvodimenzionalni niz - matricu nxm. Naći i ispisati najmanji elemenat sve do k-te kolone niza X[n,m]

Opis programa:

Tekstualni algoritam:

Listing programa:

PROGRAM p10917021;
USES
  WinCrt;
VAR
  i,j, n, m, k, min : 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;
  WRITE('izbor reda k =');
  READLN(k);
  FOR i := 1 TO n DO  {izlaz}
    BEGIN
      WRITELN;
      FOR j := 1 TO m DO
        WRITE(X[i,j]:4);
    END;
  WRITELN;
  min := X[1,1];
  FOR i := 1 TO n DO  {izlaz}
    FOR j := 1 TO k DO
      IF min > X[i,j] THEN
        min := X[i,j];
  WRITELN('Najmanji element od 1. do ', k ,'. kolone matrice =', min);
END.

Izvođenje programa:

Index