Program untuk menampilkan :
OUTPUT :
11
22 22
33 33 33
44 44 44 44
55 55 55 55 55
PROGRAM NASTED_REPEAT;
USES WINCRT;
VAR
I, J : INTEGER;
BEGIN
I := 1;
REPEAT
WRITE (I:3, I);
I := I + 1;
WRITELN;
J := I;
REPEAT
WRITE (I:3, I);
J := J - 1;
UNTIL
J <= 1
UNTIL
I > 4;
WRITE (I:3, I);
END.
PROGRAM NASTED_WHILE;
USES WINCRT;
VAR
I, J : INTEGER;
BEGIN
I := 1;
WHILE I <= 5 DO
BEGIN
WRITE (I:3,I);
J := I;
WHILE J > 1 DO
BEGIN
WRITE (I:3, I);
J := J - 1;
END;
WRITELN;
I := I + 1;
END;
END.
PROGRAM NASTED_FOR;
USES WINCRT;
VAR
I, J, bilangan : INTEGER;
BEGIN
bilangan := 0;
FOR I := 1 TO 5 DO
BEGIN
bilangan := (bilangan + 1);
FOR J := 1 TO bilangan DO
WRITE (I:3,J);
WRITELN;
END;
END.
PROGRAM NASTED_FOR;
USES WINCRT;
VAR
I, J, bilangan : INTEGER;
BEGIN
bilangan := 0;
FOR I := 1 TO 5 DO
BEGIN
bilangan := (bilangan + 1);
FOR J := 1 TO bilangan DO
WRITE (I:3,J);
WRITELN;
END;
END.
Tidak ada komentar:
Posting Komentar