ALGORITMA DAN PEMROGRAMAN 2A KUIS V-CLASS MINGGU KE-3
Nama : Fajrina Isnaeni NPM : 10108761 Kelas : 1KA20
UNIVERSITAS GUNADARMA
1: SOAL 1.1 PROGRAM KE1REPEAT; USES CRT; VAR N,A : INTEGER; BEGIN CLRSCR; A := 0; WRITE('MASUKKAN NILAI : ');READLN(N); REPEAT A := A + 1; WRITE(A,' '); UNTIL ( A = N ); READLN; END. SOAL1.2 PROGRAM KE1WHILE; USES CRT; VAR N,A : INTEGER; BEGIN CLRSCR; A := 1; WRITE('MASUKKAN NILAI N : ');READLN(N); WHILE (N >= A) DO BEGIN WRITE(A,' '); A := A + 1; END; READLN; END. SOAL 1.3 PROGRAM KE1FOR; USES CRT; VAR N,A : INTEGER; BEGIN CLRSCR; WRITE('MASUKKAN NILAI N : ');READLN(N); FOR A := 1 TO N DO
WRITE(A,' '); READLN; END. 2: SOAL 2.1 PROGRAM KE2REPEAT; USES CRT; VAR N : INTEGER; BEGIN CLRSCR; WRITE('MASUKKAN NILAI N : ');READLN(N); REPEAT WRITE(N,' '); N := N - 1; UNTIL (N = 0); READLN; END. SOAL 2.2 PROGRAM KE2WHILE; USES CRT; VAR N,A : INTEGER; BEGIN CLRSCR; A := 1; WRITE('MASUKKAN NILAI N : ');READLN(N); WHILE (N >= A) DO BEGIN WRITE(N,' '); N := N - 1; END; READLN; END. SOAL 2.3 PROGRAM KE2FOR; USES CRT; VAR N,A : INTEGER;
BEGIN CLRSCR; WRITE('MASUKKAN NILAI N : ');READLN(N); FOR A := N DOWNTO 1 DO WRITE(A,' '); READLN; END. 3: SOAL 3.1 PROGRAM KE3REPEAT; USES CRT; VAR N,A : INTEGER; BEGIN CLRSCR; A := -1; N := 15; REPEAT A := A + 2; WRITE(A,' '); UNTIL (A = N); READLN; END. SOAL 3.2 PROGRAM KE3WHILE; USES CRT; VAR N : INTEGER; BEGIN CLRSCR; N := 1; WHILE (N <= 15) DO BEGIN WRITE(N,' '); N := N+2; END; READLN; END.
SOAL 3.3 PROGRAM KE3FOR; USES CRT; VAR N,A : INTEGER; BEGIN CLRSCR; N := 0; FOR A := N TO 15 DO BEGIN A := A + 1; WRITE(A,' '); END; READLN; END. 4: SOAL 4.1 PROGRAM KE4REPEAT; USES CRT; VAR N : INTEGER; BEGIN CLRSCR; N := 17; REPEAT N := N - 2; WRITE(N,' '); UNTIL (N = 1); READLN; END. SOAL 4.2 PROGRAM KE4WHILE; USES CRT; VAR N : INTEGER; BEGIN CLRSCR; N := 15; WHILE (N >= 1) DO BEGIN
WRITE(N,' '); N := N - 2; END; READLN; END. SOAL 4.3 PROGRAM KE4FOR; USES CRT; VAR N,A : INTEGER; BEGIN CLRSCR; FOR N := 16 DOWNTO 1 DO BEGIN N := N - 1; WRITE(N,' '); END; READLN; END. 5: SOAL 5 PROGRAM KE5; USES CRT; VAR N,A : INTEGER; BEGIN CLRSCR; REPEAT A := 1; WRITE('MASUKKAN NILAI LEBIH BESAR DARI 0 :');READLN(N); WRITELN('ATTENTION_HARUS LEBIH BESAR DARI 0!!'); WRITELN; A := A + 1; UNTIL (N > 0); WRITELN('OK_NILAI YANG ANDA MASUKKAN LEBIH BESAR DARI 0'); READLN; END.