Vclass3 Anisa

  • 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 Vclass3 Anisa as PDF for free.

More details

  • Words: 438
  • Pages: 14
ALGORITMA PEMROGRAMAN A

ANISA YANUARTI 1 KA 20 10108260

[1.a]. PROGRAM BILANGAN_BULAT; USES CRT; VAR N,A,B,C : INTEGER; BEGIN CLRSCR; gotoxy(20,1); WRITELN('---Bilangan Bulat dgn For-Do---'); WRITE('Nilai : '); READLN(N); FOR A := -1 TO N DO BEGIN C := A + 1; WRITELN; writeln(C:5); END; READLN; END.

[1.b]. USES CRT; VAR i,n : INTEGER; BEGIN CLRSCR; gotoxy(20,1); writeln('---Bilangan Bulat dgn While-Do---'); write('Nilai = ');readln(n); i := 0; WHILE i <= n do begin writeln; writeln(i:5); i := i + 1; end; readln; end.

[1.c]. uses crt; var i,n : integer; BEGIN CLRSCR; gotoxy(18,1); writeln('---Bilangan Bulat dgn Repeat-Until---'); write('Nilai = ');readln(n); i := -1; repeat i := i +1; WRITELN; writeln(i:3); until i = n; readln; end.

[2.a]. uses crt; var n, x, y : integer; begin clrscr; GOTOXY(16,1); writeln('====BILANGAN BULAT DARI n s/d 1 dgn For-Do===='); write(' Nilai = ');readln(n); for x := n downto 1 do begin y := x - 1; writeln; writeln(y:3); end; readln; end.

[2.b]. uses crt; var a : integer; begin clrscr; gotoxy(14,1); writeln('///bilangan bulat dari N s/d 1 dgn while do\\\'); write('nilai = ');readln(a); a := a ; while a > 0 do begin writeln; writeln(a:3); a:= a - 1; end;

[2.c]. uses crt; var o : integer; begin clrscr; gotoxy(5,1); writeln('---Bilangan bulat dari N s/d 1 menggunakan Repeat-Until---'); gotoxy(1,3); write('Nilai = ');readln(o); o := o; repeat o := o-1; writeln; writeln(o:3); until o = 1; readln; end.

[3.a] Program nomer3_1; uses crt; var i,j,k : integer; begin clrscr; for i := 0 to 7 do begin j := (i*2)+1; writeln; writeln(j:3); end; readln; end.

[3.b]. uses crt; var a : integer; begin clrscr; a := -1; while a < 15 do begin a := a + 2; writeln; writeln(a:3); end; readln; end.

[3.c]. uses crt; var i : integer; begin clrscr; i := -1; repeat i := i+2; writeln; writeln(i:3); until i = 15; readln; end.

[4.a]. uses crt; var i : integer; begin clrscr; writeln('============= Soal Nomer 3, For-Do==================='); write('Nilai = ');readln(i); for i := i downto 0 do begin if i mod 2 = 1 then writeln(i:2); writeln; end; readln; end.

[4.b]. program while_do; uses crt; var a : integer; begin clrscr; gotoxy(20,1); writeln('---soal nomer 4 [while-do]---'); a := 15; while a >= 1 do begin writeln; writeln(a:5); a := a - 2 ; end; readln; end.

[4.c]. uses crt; var i : integer; begin clrscr; i := -1; repeat i := i+2; writeln; writeln(i:3); until i = 15; readln; end.

[5]. PROGRAM NO5; USES CRT; VAR A,B : INTEGER; BEGIN CLRSCR;

REPEAT WRITE('Silakan masukan angka lebih besar dari 0 = ');READLN(A); UNTIL (A>=0); WRITELN; WRITELN('--------<<>>---------'); READLN;

END.

Related Documents