uses crt;
var s,d:string;
i:integer;
begin
write('nhap xau:');readln(s);
d:=''
for i:=length(s) downto 1 do
d:=d+s[i];
writeln('do dai cua xau do la :',length(s));
writeln('xau theo thu tu dao nguoc la : ',d);
readln
end.
Lời giải :
Program hotrotinhoc ;
var n : string ;
i : integer ;
begin
write('Nhap xau :'); readln(n);
writeln('Do dai cua xau la:',length(n));
for i:= length(n) downto 1 do
write('Mang sau khi dao nguoc la :',n[i]);
readln
end.
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('nhap xau:'); readln(st);
d:=length(st);
writeln('do dai cua xau la: ',d);
writeln;
write('xau dao nguoc la: ');
for i:=d downto 1 do
write(st[i]);
readln;
end.
program dn;
uses crt;
var s,d:string;
i:integer;
begin
write('nhap xau:');
readln(s);
d:=''
for i:=length(s) downto 1 do d:=d+s[i];
writeln('do dai cua xau do la :',length(s));
writeln('xau theo thu tu dao nguoc la : ',d);
readln
end.