Tugas Algoritma & Pemprog. 2

  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Tugas Algoritma & Pemprog. 2 as PDF for free.

More details

  • Words: 630
  • Pages: 17
TUGAS ALGORITMA DAN PEMPROGGRAMAN 2A

WINDY ASTUTI 12108403 1 KA 20

1.Mengubah derajat temperatur, dari derajat Celcius ke derajat Fahreinheit dan Reamur (derajat Celcius diinput) ? JAWAB : PROGRAM TEMPERATURE; USES CRT; CONST X = ('------------------------------------------------'); VAR F,R,C : REAL; BEGIN CLRSCR; WINDOW(10,10,25,75); TEXTBACKGROUND(MAGENTA); TEXTCOLOR(YELLOW); SOUND(200); GOTOXY(10,2); WRITELN(X); GOTOXY(11,3); WRITELN(' MENGHITUNG TEMPERATURE '); GOTOXY(10,4); WRITELN (X); WRITELN; WRITE ('Masukan nilai celcius = ');READLN(C); F := 1.8 * C + 32; R := 0.8 * C; WRITELN (X); WRITELN; WRITELN(C:0:2,' hasil dalam Reamur sama dengan ',R:0:2,' R'); WRITELN; WRITELN(C:0:2,' hasil dalam Fahrenheit sama dengan ',F:0:2,' F'); WRITELN; NOSOUND; WRITELN (X); READLN; END.

Outputnya :

2. Menghitung Luas dan Keliling lingkaran, dengan jari-jari diketahui (diinput) ? JAWAB : USES CRT; CONST X = ('----------------------------------------------------'); VAR R,L,K : REAL; BEGIN CLRSCR; Window(10,10,25,75); Textbackground(MAGENTA); Textcolor(yellow); sound(200); GOTOXY(3,5); WRITELN(X); GOTOXY(3,6); WRITELN(' Menghitung Luas dan Keliling lingkaran GOTOXY(3,7); WRITELN (X); WRITELN; GOTOXY(10,10); WRITE('MASUKKAN JARI-JARI = ' ); READLN(R); WRITELN; GOTOXY(1,11); WRITELN(X); K := 2 * (22/7)*R; WRITE (' KELILING = ', K); WRITELN; L := (22/7)* R * R; WRITE (' LUAS = ',L); WRITELN; WRITELN(X); NOSOUND; READLN; END.

');

Outputnya :

3. Menghitung Luas dan Keliling segitiga sembarang yang ke tiga Sisinya ?

diketahui

JAWAB : USES CRT; CONST X = ('----------------------------------------------------'); VAR A,B,C,K,L : REAL; BEGIN CLRSCR; Window(10,10,25,75); Textbackground(MAGENTA); Textcolor(yellow); sound(200); GOTOXY(3,5); WRITELN(X); GOTOXY(3,6); WRITELN(' Menghitung Luas dan Keliling segitiga sembarang GOTOXY(3,7); WRITELN (X); A := 5; B := 6; C := 4; K := A + B + C; GOTOXY (10,10); WRITELN('KELILING = ',K); L := (A+B)/2; GOTOXY (12,12); WRITELN('LUAS = ',L); WRITELN; GOTOXY(2,13); WRITELN(X); NOSOUND; READLN; END.

');

Outputnya :

4. Mencari nilai Sinus, Cosinus, dan Tangen dengan sudut diinput ? JAWAB : Program Aritmatik; Uses Crt; Const y = ('------------------------------------------------'); Var x : Real; Begin Clrscr; Window(10,10,25,75); Textbackground(magenta); Textcolor(yellow); sound(100); GotoXY(10,2); Writeln(y); Gotoxy(11,3); Writeln(' Mencari Nilai Sinus ,Cosinus, dan Tangen Gotoxy(10,4); Writeln(y); Writeln; Write('Masukkan nilai dari X = ');Readln(x); Writeln (y); If x <0 Then x:= Abs (x); Writeln('Nilai X = ',x:5:2); writeln; Write(' Nilai X jika dimasukkan dalam '); Writeln('fungsi Sin,Cos,Tangen : '); writeln; Writeln('* Sinus = ',Sin(x):9:3); Writeln; Writeln('* Cosinus = ',Cos(x):9:3); Writeln; Writeln('* Tangen = ',ArcTan(x):9:3); Nosound; readln; End.

');

Outputnya :

5. Mencari akar dan kuadrat dari suatu nilai (nilai diinput) ? JAWAB :

Program Aritmatik; Uses Crt; Const y = ('----------------------------------'); Var x : Real; Begin Clrscr; Window(10,10,25,75); Textbackground(magenta); Textcolor(yellow); sound(100); GotoXY(10,2); Writeln(y); Gotoxy(11,3); Writeln(' Mencari akar dan kuadrat '); Gotoxy(10,4); Writeln(y); Writeln; Write('Masukkan nilai dari X = '); Readln (x); Writeln (y); If x <0 Then x:=Abs (x); Writeln('Nilai X = ',x:5:2); Writeln ('Nilai X dipangkatkan = ',SQRT(x):9:3); Writeln ('Nilai X diakarkan = ',SQRT(x):9:3); readln; End.

Outputnya :

6. Mencari nilai bulat dan pecahan dari suatu nilai yang dimasukkan melalui keyboard (diinput). Nilai pecahan tersebut dibulatkan sampai 3 angka dibelakang koma (,) ? JAWAB : Program Aritmatik; Uses Crt; Const y = ('------------------------------------------------'); Var x : Real; Begin Clrscr; Window(10,10,25,75); Textbackground(magenta); Textcolor(yellow); sound(100); GotoXY(10,2); Writeln(y); Gotoxy(11,3); WRITELN(' Menghitung nilai bulat dan pecahan gotoxy(10,4); Writeln(y); Writeln; Gotoxy(1,8); Write('Masukkan nilai dari X = ');Readln(x); Writeln (y); If x <0 Then x:= Abs (x); Writeln('Nilai X = ',x:5:2); writeln; Writeln ('Nilai Bulatnya = ',INT(x):5:3); Writeln ('Nilai Pecahannya = ',FRAC(x):5:3); Nosound; readln; End.

');

Outputnya :

7. Tampilkan nama dan NPM anda di dalam window, dan terletak pada tengah - tengah layar ? JAWAB : Program Layar1; Uses Crt; Var x : Char; Begin ClrScr; Window(10,10,25,75); Textbackground(magenta); Textcolor(yellow); sound(100); GotoXY(31,10); Writeln (' NAMA : Windy Astuti'); GotoXY (31,11); Writeln (' N P M : 12108403 '); Nosound; Readln; End.

Outputnya :

8.Tampilkan tulisan 'STMIK GUNADARMA' di dalam window pada pojok kanan atas dengan ukuran window sama dengan tulisan tersebut. JAWAB : PROGRAM Layar2; USES CRT; BEGIN CLRSCR; WINDOW(20,25,50,100); TEXTBACKGROUND(RED); TEXTCOLOR(YELLOW); SOUND(220); GOTOXY(65,1); WRITELN('STIMIK GUNADARMA'); NOSOUND; READLN; END.

Outputnya :

Related Documents