PROGRAM
pola2;
VAR
n,a,b,c :
integer
;
BEGIN
readln(n);
FOR
a:=
1
TO
n
DO
begin
for
b:=
1
TO
a
DO
begin
if
c =
10
then
c:=
0
;
write
(c);
c := c+
1
;
end
;
writeln
;
end
;
end
.
PROGRAM
pola2;
VAR
n,a,b,c :
integer
;
BEGIN
readln(n);
FOR
a:=
1
TO
n
DO
begin
for
b:=
1
TO
a
DO
begin
if
c =
10
then
c:=
0
;
write
(c);
c := c+
1
;
end
;
writeln
;
end
;
end
.
program
pola1;
var
N,i,j,k :
integer
;
begin
read(N);
for
i:=
1
to
N
do
begin
for
j:=
1
to
N-i
do
write
(
' '
);
for
k:=
1
to
i
do
write
(
'*'
);
writeln
;
end
;
readln;
readln
end
.
program
pangkatdua;
var
m,n:
longint
;
begin
read(N);
m:=
1
;
while
m<n
do
m:=m*
2
;
if
m=n
then
writeln
(
'TRUE'
)
else
writeln
(
'FALSE'
);
readln; readln
end
.
program
Breakcontinue;
var
n:
integer
;
i:
integer
;
begin
readln(n);
for
i :=
1
to
n
do
begin
if
(i =
93
)
then
begin
writeln
(
'ERROR'
);
break;
end
;
if
(i
mod
10
=
0
)
then
continue;
writeln
(i);
end
;
end
.
program
forfor;
var
jml,jbil,i,bil :
integer
;
begin
jml :=
0
;
read(jbil);
for
i :=
1
to
jbil
do
begin
read(bil);
jml := jml + bil;
end
;
writeln
(jml);
readln
end
.
var
jumlah,bil :
longint
;
begin
jumlah :=
0
;
while
not
eof(input)
do
begin
readln(bil);
jumlah := jumlah + bil;
end
;
writeln
(jumlah);
readln
end
.
Solusi BAB 1C : Perulangan - While
var
kalimat :
string
;
begin
while
not
eof(input)
do
begin
readln(kalimat);
writeln
(kalimat);
end
;
readln
end
.