blink

TERIMAKASIH TELAH BERKUNJUNG. HARAP MENGISI GUESTBOOK PADA POJOK KANAN BLOG !

Friday, January 4, 2013

PROGRAM MEMBALIK HURUF DALAM SEBUAH KATA

uses crt;
var x, l : string;
a, b, c , d, e, i , j, k : integer;
begin
clrscr;
repeat
begin
clrscr;

write ('masukkan kata atau kalimat : ');readln (x);
a :=length (x);
b := 0;
for i := 1 to a do
begin
if x[i]=' ' then

begin
for j := 1 to b do
begin
write (x[i-j]);
end;
write(' ');
b := 0;
end
else if i = a then
begin
for k := 1 to b+1 do
begin
write (x[i+1-k]);
end;
end
else inc (b);
end;
writeln;
writeln;
write ('try again (yes/no) : ');readln (l);
end;
Post a Comment