Latihan 6.14 Menggunakan Kata kunci forward (bagian 2)

9:22 AM

Koding:

program ContohForward2;

uses
crt;

procedure Tulis(var N: integer); forward;

procedure TurunkanNilai (var indeks: integer);
begin
indeks := indeks -1;
if indeks > 0 then begin
Tulis(indeks);
end;
end;

procedure Tulis(var N: integer);
begin
writeln(N);
TurunkanNilai(N);
end;

var
i : integer;
begin
i := 5;
writeln('Menggunakan prosedur TurunkanNilai');
TurunkanNilai(i);
writeln;

i := 5;
writeln('Menggunakan prosedur Tulis');
Tulis(i);
readln;
end.


Output :





Artikel Terkait

Previous
Next Post »

COMMENT BOX EmoticonEmoticon