Program Soal1

  • July 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 Program Soal1 as PDF for free.

More details

  • Words: 377
  • Pages: 6
PROGRAM SOAL1; USES CRT; VAR BILANGAN: INTEGER; KETERANGAN: STRING; BEGIN CLRSCR; WRITE('MASUKAN BILANGAN = '); READLN(BILANGAN); IF (BILANGAN<0) THEN KETERANGAN:= 'BILANANGAN NEGATIF' ELSE IF(BILANGAN>0) THEN KETERANGAN:='BILANGAN POSITIF' ELSE KETERANGAN:='BILANGAN NOL'; WRITELN('KETERANGAN = ',KETERANGAN); READLN; END. PROGRAM SOAL2; USES CRT; VAR BILANGAN:INTEGER; KETERANGAN:STRING; BEGIN CLRSCR; WRITE('MASUKAN BILANGAN = '); READLN(BILANGAN); IF(BILANGAN MOD 2=0) THEN KETERANGAN:='BILANGAN GENAP' ELSE KETERANGAN:='BILANGAN GANJIL'; WRITELN('KETERANGAN = ',BILANGAN,' ADALAH ',KETERANGAN); READLN; END. PROGRAM SOAL3; USES CRT; VAR NAMA,JENISKELAMIN:STRING; BERATBADAN,JUMLAHKALORI:INTEGER; BEGIN CLRSCR; WRITE('MASUKAN NAMA : '); READLN(NAMA); WRITE('JENIS KELAMIN [PRIA]/[WANITA] : '); READLN(JENISKELAMIN); WRITE('MASUKAN BERATBADAN : '); READLN(BERATBADAN); IF(JENISKELAMIN='PRIA') THEN JUMLAHKALORI:= 9*BERATBADAN ELSE JUMLAHKALORI:= 8*BERATBADAN; WRITELN('JUMLAHKALORI

:',JUMLAHKALORI);

READLN; END. PROGRAM SOAL5; USES CRT; VAR NILAI:INTEGER; IP:CHAR; BEGIN CLRSCR; WRITE('NILAI : '); READLN(NILAI); IF (NILAI>=90) THEN IP:='A' ELSE IF (NILAI>=75) THEN IP:='B' ELSE IF (NILAI>=65) THEN IP:='C' ELSE IF (NILAI>=60) THEN IP:='D' ELSE IP:='E'; WRITE('IP= ',IP); READLN; END.

PROGRAM SOAL6;

USES CRT; VAR A,B,C,D,X1,X2:REAL; BEGIN WRITE('MASUKAN A : '); READLN(A); WRITE('MASUKAN B : '); READLN(B); WRITE('MASUKAN C : '); READLN(C); D:=B*B-4*A*C; WRITELN('NILAI D :',D:3:0); WRITELN; IF (D<0) THEN BEGIN WRITELN('AKAR - AKAR BILANGAN KOMPLEKS'); X1:=-B/(2*A); D:=SQRT(-D)/(2*A); WRITELN('X1=',X1:3:0,' + ',D:3:0,'i'); WRITELN('X2=',X1:3:0,' + ',D:3:0,'i'); END ELSE IF (D=0) THEN BEGIN WRITELN('AKAR - AKARNYA KEMBAR '); X1:=(-B/(2*A)); WRITELN('X1=X2=',X1:3:0); END ELSE BEGIN

WRITELN('AKAR - AKARNYA BILANGAN REAL '); X1:=(-B+SQRT(D))/(2*A); WRITELN('X1=',X1:5:2); X2:=( -B-SQRT(D))/(2*A); WRITELN('X2= ',X2:5:2); END; READLN; END. PROGRAM SOAL7; USES CRT; VAR BARANG: INTEGER; TOTAL, HARGAPERBARANG: LONGINT; BEGIN CLRSCR; WRITE('BERAPA JUMLAH BARANG YANG DIBELI = '); READLN(BARANG); IF (BARANG<100) THEN HARGAPERBARANG:=10000 ELSE IF (BARANG<150) THEN HARGAPERBARANG:=9500 ELSE HARGAPERBARANG:=9000 ; TOTAL:=HARGAPERBARANG*BARANG; WRITE('TOTAL YANG HARUS DIBAYAR : ',TOTAL); READLN; END. PROGRAM SOAL8; USES CRT;

VAR NILAIKURIKULER,MATEMATIKA,FISIKA,BIOLOGI,EKONOMI,KIMIA:REAL; NILAIEKSTRAKULIKULER,PRAMUKA,PMR,RATARATA:REAL; PREDIKAT:STRING; BEGIN CLRSCR; WRITELN('MEMASUKKAN NILAI KURIKULER'); WRITE('MASUKAN NILAI MATEMATIKA : '); READLN(MATEMATIKA); WRITE('MASUKAN NILAI FISIKA

: ');

READLN(FISIKA); WRITE('MASUKAN NILAI BIOLOGI

: ');

READLN(BIOLOGI); WRITE('MASUKAN NILAI EKONOMI

: ');

READLN(EKONOMI); WRITE('MASUKAN NILAI KIMIA

: ');

READLN(KIMIA); NILAIKURIKULER:=(MATEMATIKA+FISIKA+BIOLOGI+EKONOMI+KIMIA)/5; WRITELN('NILAI RATA-RATA KURIKULER

: ',NILAIKURIKULER:4:0);

WRITELN; WRITELN('MEMASUKKAN NILAI EKSTRA KURIKULER'); WRITE('MASUKAN NILAI PRAMUKA

: ');

READLN(PRAMUKA); WRITE('MASUKAN NILAI PMR

: ');

READLN(PMR); NILAIEKSTRAKULIKULER:=(PRAMUKA+PMR)/2; WRITE('NILAI RATA-RATA EKSTRA KURIKULER

: ',NILAIEKSTRAKULIKULER:4:0);

WRITELN; RATARATA:=(60/100*NILAIKURIKULER)+(NILAIEKSTRAKULIKULER*40/100);

IF (RATARATA>=80) THEN PREDIKAT:= 'SANGAT BAGUS' ELSE IF (RATARATA>=60) THEN PREDIKAT:= 'BAGUS' ELSE IF (RATARATA>=40) THEN PREDIKAT:= 'CUKUP BAGUS' ELSE IF (RATARATA>=20) THEN PREDIKAT:= 'KURANG' ELSE PREDIKAT:= 'SANGAT KURANG'; WRITELN('NILAI KURIKULER

= ',NILAIKURIKULER:5:0);

WRITELN('NILAI EKSTRA KURIKULER = ',NILAIEKSTRAKULIKULER:5:0); WRITELN('INDEKS PRESTASI

= ',RATARATA:5:0);

WRITELN('PREDIKAT

= ',PREDIKAT);

READLN; END.

Related Documents

Program Soal1
July 2020 3
Soal1.docx
November 2019 0
Program
May 2020 25
Program
October 2019 41
Program
June 2020 15