V-class Pa'achsan (kuis 3)

  • Uploaded by: tami
  • 0
  • 0
  • May 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 V-class Pa'achsan (kuis 3) as PDF for free.

More details

  • Words: 566
  • Pages: 26
V-CLASS ALGORITMA & PEMROGRAMAN 2A (KUIS 3 ) NAMA : HUTAMI DWI JAYANTI NPM : 10108977 KELAS : 1 KA 20

SOAL 1 Program untuk mencetak bilangan bulat dari 1 s/d N menggunakan struktur pengulangan Repeat-Until, While dan

* Repeat-Until PROGRAM REPEAT_UNTIL; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; B := 0; WRITE('MASUKKAN BILANGAN : ');READLN(A); REPEAT B := B + 1; WRITE(B,' '); UNTIL ( B = A); READLN; END.

OUTPUT

* While-Do : PROGRAM WHILE_DO; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; B := 1; WRITE('MASUKKAN BILANGAN : ');READLN(A); WHILE (A >= B) DO BEGIN WRITE(B,' '); B := B + 1; END; READLN; END.  

OUTPUT

* For-To-Do : PROGRAM FOR_TO_D0; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; WRITE('MASUKKAN BILANGAN : ');READLN(A); FOR B := 1 TO A DO WRITE(B,' '); READLN; END.

OUTPUT

Soal 2

Program untuk mencetak bilangan bulat dari N s/d 1 menggunakan struktur pengulangan Repeat-Until, While dan For. Nilai N diinputkan dari keyboard. * Repeat-Until

PROGRAM REPEAT_UNTIL; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; WRITE('MASUKKAN BILANGAN : ');READLN(A); REPEAT WRITE(A,' '); A := A - 1; UNTIL (A = 0); READLN; END.

OUTPUT

* While-Do : PROGRAM WHILE_DO; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; B := 1; WRITE('MASUKKAN BILANGAN : ');READLN(A); WHILE (A >= B) DO BEGIN WRITE(A,' '); A := A - 1; END; READLN; END.

OUTPUT

* For-DownTo-Do : PROGRAM FOR_DOWNTO_DO; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; WRITE('MASUKKAN BILANGAN : ');READLN(A); FOR B := A DOWNTO 1 DO WRITE(B,' '); READLN; END.

OUTPUT

Soal 3

Program untuk mencetak bilangan bulat sbb: 1 3 5 7 9 11 13 15 menggunakan struktur pengulangan RepeatUntil, While dan For.

* Repeat-Until PROGRAM REPEAT_UNTIL; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; B := -1; A := 15; REPEAT B := B + 2; WRITE(B,' '); UNTIL (B = A); READLN; END.

OUTPUT

* While-Do : PROGRAM WHILE_DO; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; A := 1; WHILE (A <= 15) DO BEGIN WRITE(A,' '); A := A+2; END;READLN; END.

OUTPUT

* For-To -Do: PROGRAM FOR_TO; USES CRT; VAR A,B,C : INTEGER; BEGIN CLRSCR; A := 0; FOR B := A TO 15 DO BEGIN B := B + 1; WRITE(B,' '); END; READLN; END.

OUTPUT

Soal 4

Program untuk mencetak bilangan bulat sbb: 15 13 11 9 7 5 3 1 menggunakan struktur pengulangan RepeatUntil, While dan For.

* Repeat-Until

PROGRAM REPEAT_UNTIL; USES CRT; VAR A : INTEGER; BEGIN CLRSCR; A := 17; REPEAT A := A - 2; WRITE(A,' '); UNTIL (A = 1); READLN; END.

OUTPUT

* While-Do : PROGRAM WHILE_DO; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; A := 15; WHILE (A >= 1) DO BEGIN WRITE(A,' '); A := A - 2; END; READLN; END.

OUTPUT

* For-DownTo-Do : PROGRAM FOR_DOWNTO_DO; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; FOR B := 16 DOWNTO 1 DO BEGIN B := B - 1; WRITE(B,' '); END; READLN; END.

OUTPUT

Soal 5

Program untuk memasukan bilangan yang lebih besar dari nol. Program akan terus menerus minta inputan jika nilai yang dimasukan lebih kecil atau samadengan nol.

USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR; REPEAT B := 1; WRITE('Masukkan angka yg lebih besar dari nol : ');READLN(A); WRITELN('Harus lebih besar dari nol..!'); writeln; B := B + 1; UNTIL (A > 0); WRITELN(‘Angka Anda Baru Benar..'); READLN; END.

Related Documents

Vclass 3
May 2020 11
Vclass
November 2019 14
Kuis
May 2020 38
Kuis Berhadiah.docx
June 2020 44
Kuis Sia.docx
December 2019 46

More Documents from "Marcdhi Cahyo Wiguno"