viết ct nhập giá trị vào cho xâu, đưa ra các kí tự a có trong sâu ra màn hình
2 câu trả lời
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:');
readln(s);
dem:= 0;
for i:= 1 to length(s) do if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+i;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var s : string; i, d : byte;
begin
clrscr;
d := 0;
write('Nhap xau : '); readln(s);
for i := 1 to length(s) do
if s[i] = 'a' then
begin
writeln('Ki tu a o vi tri so ', i);
d := d + 1;
end;
write('Xau co ', d ,' ki tu a');
readln
end.

