nhập vào một xâu kí tự.Đếm và in ra màn hình số kí tự là chữ cái thường
0 bình luận về “nhập vào một xâu kí tự.Đếm và in ra màn hình số kí tự là chữ cái thường”
uses crt; var st : string; i,j,dem :integer; begin clrscr; write(‘Nhap xau ki tu :’); readln(st); for i:=i to length(st) do if st[i] in [‘a’..’z’] then begin dem:=dem+1; write(st[i]:3); end; writeln; write(‘Dem so ki tu thuong :’, dem); readln end.
program oken; uses crt; var s: string; i,dem: byte; begin clrscr; write(‘Nhap xau: ‘); readln(s); write(‘Cac ky tu la chu thuong trong xau: ‘); for i:=1 to length(s) do if (s[i] in [‘a’..’z’]) then begin dem:=dem+1; write(s[i],’ ‘); end; writeln; writeln(‘So ky tu la chu thuong trong xau: ‘,dem); readln; end.
uses crt;
var st : string;
i,j,dem :integer;
begin clrscr;
write(‘Nhap xau ki tu :’); readln(st);
for i:=i to length(st) do
if st[i] in [‘a’..’z’] then begin dem:=dem+1;
write(st[i]:3);
end;
writeln;
write(‘Dem so ki tu thuong :’, dem);
readln
end.
program oken;
uses crt;
var s: string;
i,dem: byte;
begin
clrscr;
write(‘Nhap xau: ‘); readln(s);
write(‘Cac ky tu la chu thuong trong xau: ‘);
for i:=1 to length(s) do
if (s[i] in [‘a’..’z’]) then
begin
dem:=dem+1;
write(s[i],’ ‘);
end;
writeln;
writeln(‘So ky tu la chu thuong trong xau: ‘,dem);
readln;
end.