Segitiga Siku-Siku :
1. FOR b = 1 TO a
FOR c = 1 TO b
PRINT c;
NEXT c
PRINT
NEXT b
Contoh Hasil Output :
1
12
123
2. FOR b = 1 TO a
FOR c = 1 TO b
PRINT b;
NEXT c
PRINT
NEXT b
Contoh Hasil Output :
1
22
333
Segitiga Siku-Siku Terbalik :
1. FOR b = a TO 1 STEP -1
FOR c = 1 TO b
PRINT c;
NEXT c
PRINT
NEXT b
Contoh Hasil Output :
123
12
1
2. FOR b = a TO 1
STEP -1
FOR c = 1 TO b
PRINT b;
NEXT c
PRINT
NEXT b
Contoh Hasil Output :
333
22
1
3. FOR b = 1 TO a
FOR c = a TO b STEP -1
PRINT c;
NEXT c
PRINT
NEXT b
Contoh
Hasil Output :
321
32
3
mas bro logikanya dong.. kenapa hasil ouput yang ke 1 dan 2 bisa beda urutannya padahal cuma beda diprintnya doang
ReplyDelete