109.1.. Učitati dva dvodimenzionalna niza i formirati drugi čiji je opšti član: yij = xijj za i parno, inače je yij =0.

Opis programa:

Tekstualni algoritam:

Listing programa:

PROGRAM p10912023;
 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 MOD 2= 0 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