Bài 3:
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
for i:=1 to length(s) do s[i]:=upcase(s[i]);
write('Xau sau khi in hoa : ',s);
readln
end.
Bài 4:
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
write('Xau sau khi dao nguoc: ');
for i:=length(s) downto 1 do write(s[i]);
readln
end.
Bài 1:
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
while s[1]=#32 do delete(s,1,1);
while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);
while s[length(s)]=#32 do delete(s,length(s),1);
for i:=1 to length(s) do
if s[i]=#32 then writeln(s[i]) else write(s[i]);
writeln;
readln
end.
Bài 2:
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
while s[1]=#32 do delete(s,1,1);
while pos(#32,s)<>0 do delete(s,pos(#32,s),1);
while s[length(s)]=#32 do delete(s,length(s),1);
writeln('Xau sau khi xoa ki tu trong: ',s);
readln
end.
Bài 4:
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=d downto 1 do
write(st[i]);
readln;
end.