109.1.. Učitati dvodimenzionalni niz i formirati drugi čiji je opšti član: yij = xij za i>j, inače je yij = 0.

Opis programa:

Tekstualni algoritam:

Listing programa:

PROGRAM p10912020;
 USES    WinCrt; 
 VAR    i,j, n, m : INTEGER;    
 X, y, C : ARRAY [1..15,1..15] OF INTEGER; 
 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  {formiranje matrice Y}     
  FOR j := 1 TO m DO 
    IF  i>j THEN    
      Y[i,j] := X[i,j]
    ELSE
      Y[i,j] := 0;
  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;
END.

Izvođenje programa:

Index