0% found this document useful (0 votes)
291 views

Transpose Matrix With Pascal

This Pascal program defines procedures to input matrix data from the user, print the original and transposed matrices to the screen, and transpose two matrices. The input procedure prompts the user to enter the dimensions and values of matrices A and B. The cetak procedure prints the original matrices. The transpose procedure calculates and prints the transposed matrices by iterating through the columns first instead of the rows.

Uploaded by

Maulana Ariandy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
291 views

Transpose Matrix With Pascal

This Pascal program defines procedures to input matrix data from the user, print the original and transposed matrices to the screen, and transpose two matrices. The input procedure prompts the user to enter the dimensions and values of matrices A and B. The cetak procedure prints the original matrices. The transpose procedure calculates and prints the transposed matrices by iterating through the columns first instead of the rows.

Uploaded by

Maulana Ariandy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Transpose Matrix With Pascal

program transpose_matrix; uses crt; var a : array [0..100,0..100] of integer; b : array [0..100,0..100] of integer; c : array [0..10,0..10] of integer; ba,ka,bb,kb,i,h,j,k,x,y: integer; procedure input; begin clrscr; writeln (' Masukan inputan matrix ') ; writeln; write ('Masukan jumlah baris matriks A: '); readln (ba); write ('Masukan jumlah kolom matriks A: '); readln (ka);writeln; write ('Masukan jumlah baris matriks B: '); readln (bb); write ('Masukan jumlah kolom matriks B: '); readln (kb); writeln; writeln ('Masukan komponen data Matriks A'); for h:=1 to ba do begin for i:=1 to ka do begin write ('Data ke-(',h,',',i,')= '); readln (a[h,i]); end; end; writeln; writeln ('Masukan komponen data matriks B'); for j:=1 to bb do begin for k:=1 to kb do begin write ('Data ke-(',j,',',k,')= '); readln (b[j,k]); end; end; end; Procedure cetak; begin clrscr; writeln ('Transpose Matrix') ; writeln; writeln ('Data yang anda masukan adalah :');writeln; writeln ('Matriks a'); for h:=1 to ba do begin for i:=1 to ka do write (' ',a[h,i],' '); writeln; end; writeln;

gotoxy (27,5);writeln ('Matriks b'); y:=6; for j:=1 to bb do begin x:=27; for k:=1 to kb do begin gotoxy(x,y);write (' ',b[j,k],' '); x:=x+3;end; y:=y+1; end;writeln; end; procedure transpose; begin writeln ('Transpose matriks a'); for i:=1 to ka do begin for h:=1 to ba do write (' ',a[h,i],' '); writeln; end; writeln; gotoxy(27,y+2);writeln ('Transpose matriks b'); y:=y+3; for k:=1 to kb do begin x:=27; for j:=1 to bb do begin gotoxy(x,y);write (' ',b[j,k],' ');x:=x+3; end;y:=y+1; writeln; end;writeln; end; begin clrscr; input; cetak; writeln; writeln; transpose; readln; end.

You might also like