For b 1 to 5 Do
For K 1 to b Do
Write (*)
End For
Writeln
End For
2. For b 1 to 5 Do
For K 1 to b Do
Write (‘k’)
End For
Writeln
End For
3. For b 1 to 5 Do
For K 1 to 5 Do
Write (b+k-1)
End For
Writeln
End For
4. For b 1 to 5 Do
For K 1 to 5 Do
If (b>=k)
then
Write (‘x’)
Else
Write (‘0’)
End if
End For
Writeln
End For
1. X 0 X 0 X
X 0 X 0 X
X 0 X 0 X
X 0 X 0 X
2. 0 0 0 0 0
X X X X X
0 0 0 0 0
X X X X X
0 0 0 0 0
3. X 0 X 0 X
0 X 0 X 0
X 0 X 0 X
0 X 0 X 0
X 0 X 0 X
4. 5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
5. 0 1 2 3 4
1 0 1 2 3
2 1 0 1 2
3 2 1 0 1
4 3 2 1 0
6. X X X X 0
X X X 0 0
X X 0 0 0
X 0 0 0 0
0 0 0 0 0
7. 1 2 3 4 5
1 2 3 4
1 2 3
1 2
8. 0 1 1 1 1
2 0 2 2 2
3 6 0 3 3
4 8 12 0 4
5 10 15 20 0
9. 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
10. 5 4 3 2 1
5 4 3 2
5 4 3
5 4
11. 5
5 4
5 4 3
5 4 3 2
5 4 3 2 1
12. 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
13. 1 5
2 4
2 4
1 5
14. 5 4 3 2 1
5 4 3 2 1
5 4 3 2 1
15. 5
5 4
5 4 3
5 4 3 2
5 4 3 2 1
16. 1 2 3 4 5
12 3 4
1 2 3
1 2
17. 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
18. 5 4 3 2 1
4 3 2 1
3 2 1
2 1
a. 1 5
2 4
2 4
1 5
b. #
# #
# # #
# # # #
# # # # #
Variabel
A,b,c,d : integer
Mulai
a { ANGKA NPM TERAKHIR ANDA}
a a+1
d ( 14 + a x 2) div 2
d d-a
b 0
c 1
if ( d mod 2 = 0) then
b b+1
end if
c c+1
end while
write (b)
write (d)
if ( b = 2) then
write (‘UNIVERSITAS’)
else
write (‘INDRAPRASTA’)
end if
selesai
Algoritma UPM_TIGA
Variabel
Satu,dua,tiga : integer
Mulai
satu 2500
dua 100
while (satu >= dua) do
tiga Satu
write (tiga)
endwhile
write (satu)
selesai
a. 2 3 4 5 6
4 5 6 7
6 7 8
8 9
10
b. 5
4 4
3 3 3
2 2 2 2
1 1 1 1 1
Variabel
A,b,c,d : integer
Mulai
a a+1
d ( 14 + a x 2) div 2
d d-a
b 0
c 1
if ( d mod 2 = 0) then
b b+1
end if
c c+1
end while
write (b)
write (d)
if ( b = 2) then
write (‘UNIVERSITAS’)
else
write (‘INDRAPRASTA’)
end if
selesai
c. 2 3 4 5 6
4 5 6 7
6 7 8
8 9
10
a. Algoritma UPM_3
Variabel
X : integer
Mulai
For x = 1 to 5 do
If (x mod 2 = 0) then
Writeln (‘merah’)
Else
Writeln ( ‘kuning’)
Else
Write(‘hijau’)
Endfor
Selesai
b. Algoritma UPM_dua
Variabel
X,y : integer
Mulai
X 5
Y 10
While (x>0) do
y y-x
x x-1
endwhile
write(y)
selesai