program hitung_NG;
uses wincrt;
type
nomor = 1..22;
Larik = array[nomor] of char;
const
Kalimat : Larik = ('W','H','E','N',' ','S','A','N','G','K','A','L','A',' ','T','A','L','K','I','N','G','#');
var
x,jumlah : integer;
begin
if Kalimat[1] = '#' then writeln('Cuma Teks Kosong...') else
begin
x := 1;
jumlah := 0;
while Kalimat[x] <> '#' do
begin
write(Kalimat[x]);
if (Kalimat[x] = 'N') and (Kalimat[x+1] = 'G') then jumlah := jumlah+1;
x := x+1;
end;
end;
writeln;
writeln ('**********************************************') ;
writeln('Frekuensi pasangan huruf NG berjumlah : ',jumlah,' buah');
writeln ('**********************************************') ;
end.
Nah ini hasil setelah programnya di running :
0 komentar:
Post a Comment