Contoh program pascal

contoh program sederhana pascal...


PROGRAM TIME;
USES CRT;
VAR DD,A,B,C,AA,BB,CC,M,MM,D,J,BYR:LONGINT;
BEGIN
CLRSCR;
WRITE('JAM MASUK:');READLN(A);
WRITE('MENIT MASUK:');READLN(B);
WRITE('DETIK MASUK:');READLN(C);
WRITE('JAM KELUAR:');READLN(AA);
WRITE('MENIT KELUAR:');READLN(BB);
WRITE('DETIK KELUAR:');READLN(CC);
M:=(AA-A)*60+(BB-B);
DD:=M*60+(CC-C);
J:=M DIV 60;
MM:=M MOD 60;
D:=DD MOD 60;
BYR:=(J*2000)+(MM*50);
WRITELN('DURASI :',J,' JAM ',MM,' MENIT ',D,' DETIK');
WRITE('BAYAR :RP.',BYR);
READKEY;
END.



PROGRAM MATRIX_DGN_ARRAY;
USES CRT;

TYPE
M=ARRAY[1..3,1..3] OF INTEGER;

VAR
MATRIX1,MATRIX2,MATRIX3:M;
K,L:BYTE;

BEGIN
CLRSCR;
WRITELN('MATRIX 1');
FOR K:=1 TO 3 DO
FOR L:=1 TO 3 DO
begin
GOTOXY(01,02);WRITE ('MASUKKAN BARIS',' ',K,' ','KOLOM',' ',L,':');
READLN (MATRIX1[K,L]);
END;
FOR K:=1 TO 3 DO
BEGIN
FOR L:=1 TO 3 DO
begin
WRITE(MATRIX1[K,L],' ');
END;
WRITELN;
END;
WRITELN('MATRIX 2');
FOR K:=1 TO 3 DO
FOR L:=1 TO 3 DO
begin
GOTOXY(01,07);WRITE ('MASUKKAN BARIS',' ',K,' ','KOLOM',' ',L,':');
READLN (MATRIX2[K,L]);
END;
FOR K:=1 TO 3 DO
BEGIN
FOR L:=1 TO 3 DO
begin
WRITE(MATRIX2[K,L],' ');
END;
WRITELN;
END;
WRITELN('HASIL PENJUMLAHAN MATRIK 1 DAN 2');
FOR K:=1 TO 3 DO
BEGIN
FOR L:=1 TO 3 DO
BEGIN
WRITE(MATRIX1[K,L]+MATRIX2[K,L],' ');
END;
WRITELN;
END;
WRITELN('HASIL PENGURNGAN MATRIK 1 DAN 2');
FOR K:=1 TO 3 DO
BEGIN
FOR L:=1 TO 3 DO
BEGIN
WRITE(MATRIX1[K,L]-MATRIX2[K,L],' ');
END;
WRITELN;
END;
READKEY;
END.

Comments

Popular posts from this blog

Membuat File Resource (*.res)