TUGAS ke-2 ALG ORITMA & PEM RO GRAMA N 2A NAMA : LU KMA N AFFA ND I NPM : 11108165 KELA S : 1 KA 20
1. MENGUBAH DERAJAT CELCIUS KE DERAJAT REAMUR DAN FAHRENHAIT USES CRT; VAR C,R,F : REAL; BEGIN CLRSCR; WINDOW(5,6,25,78); TEXTBACKGRAOUND(MAGENTA); TEXTCOLOR(WHITE); SOND(220); WRITE (‘ MASUKKAN NILAI C = ‘); READLN (C); R := C *(5/9); WRITELN(‘ REAMUR = ‘,R); F := C + 273; WRITELN(‘FAHRENHAIT = ‘,F); NOSOUND; READLN; END.
OUTPUT
2.MENGHITUNG LUAS DAN KELILING LINGKARAN USES CRT; VAR R,L,K : REAL;
BEGIN CLRSCR; WINDOW(10,13,27,80); TEXTBACKGROUND(WHITE); TEXTCOLOR(GREEN); SOUND(115);
WRITE(‘MASUKKAN JARI-JARI = ‘ ); READLN(R); K := 2 * (22/7)*R; WRITE (‘ KELILING = ‘, K); L := (22/7)* R * R; WRITE (‘LUAS = ‘,L);
NOSOUND; READLN; END.
OUTPUT
3. MENGHITUNG LUAS DAN KELILING SEGITIGA USES CRT; VAR A,B,C,K,L : REAL; BEGIN CLRSCR; WINDOW(5,5,35,70); TEXTBACKGROUND(YELLOW); TEXTCOLOR(BLUE); A := 3; B := 4; C := 5; K := A + B + C; GOTOXY (13,13); WRITELN(‘KELILING = ‘,K); L := (A+B)/2 GOTOXY (20,16); WRITELN(‘LUAS = ‘,L); READLN; END.
OUTPUT
4.MENENTUKAN NILAI SIN,COS,DAN TANGEN USES CRT VAR X : REAL; BEGIN CLRSCR; WINDOW(5,5,35,68); TEXTBACKGROUND(WHITE); TEXTCOLOR(CYAN); SOUND(70);
WRITE(‘BESAR SUDUT = ‘); READLN(X); WRITELN(‘SIN = ‘,SIN(X)); WRITELN(‘COS= ‘,COS(X)); WRITELN(‘TAN = ‘,ARCTAN(X));
NOSOUND; READLN; END.
OUTPUT
5. MENCARI AKAR DAN KUADRAT NILAI USES CRT VAR X : REAL; BEGIN CLRSCR; WINDOW(5,5,35,68); TEXTBACKGROUND(WHITE); TEXTCOLOR(BLACK); SOUND(70);
WRITE(‘MASUKKAN NILAI = ‘); READLN(X); GOTOXY(11,20); WRITELN(‘AKAR = ‘,SQRT(X):9:3); GOTO XY(13,44); WRITELN(‘PANGKAT = ‘,SQR(X):9:3);
NOSOUND; READLN; END.
OUTPUT
6. MENCARI NILAI BULAT DAN PECAHAN USES CRT; VAR X : REAL; BEGIN CLRSCR; WINDOW(5,7,32,70); TEXTBACKGROUND(WHITE); TEXTCOLOR(red); SOUND(85);
WRITE(‘MASUKKAN NILAI = ‘); READLN(X); GOTOXY(11,14); WRITELN(‘PECAHAN= ‘,FRAC(X):5:3); GOTOXY(15,20); WRITELN(‘BILANGAN BULAT = ‘,INT(X):5:3);
NOSOUND; READLN; END.
OUTPUT
7. MENAMPILKAN NAMA DAN NPM DI TENGAH LAYAR USES CRT; BEGIN CLRSCR; WINDOW(5,7,32,70); TEXTBACKGROUND(WHITE); TEXTCOLOR(red); SOUND(85);
GOTOXY(30,10); WRITELN (‘NAMA : ERRISTHYA ‘); GOTOXY(30,11); WRITELN (‘NPM : 10108716’); NOSOUND; READLN; END.
OUTPUT
8. MENULIS STMIK GUNADARMA DI POJOK KANAN ATAS LAYAR & UKURAN WINDOW SAMA!! USES CRT; BEGIN CLRSCR; WINDOW(1,2,65,70); TEXTBACKGROUND(GREEN); TEXTCOLOR(red); SOUND(85);
GOTOXY(65,1); WRITELN (‘STMIK GUNADARMA’); NOSOUND; READLN; END
OUTPUT