Viết chương trình nhập một sâu từ bàn phím. Hãy hiển thị vị trí của kí tự A trong sâu vừa nhập lên màn hình 19/07/2021 Bởi Katherine Viết chương trình nhập một sâu từ bàn phím. Hãy hiển thị vị trí của kí tự A trong sâu vừa nhập lên màn hình
Program bai_tap; Uses crt; Var s :string[100]; i :integer; Begin clrscr; write(‘Nhap xau:’,s); readln(s); if pos(‘A’,s)=0 then write(‘Khong co’) else for i:= 1 to length(s) do if s[i]=’A’ then write(i,’ ‘); readln; End. Bình luận
program vi_tri; uses crt; var s:string; i:byte; begin clrscr; write(‘Nhap xau: ‘); readln(s); if pos(‘A’,s)=0 then write(‘Khong co’) else for i:=1 to length(s) do if s[i]=’A’ then write(i,’ ‘); readln; end. Bình luận
Program bai_tap;
Uses crt;
Var s :string[100];
i :integer;
Begin
clrscr;
write(‘Nhap xau:’,s);
readln(s);
if pos(‘A’,s)=0 then write(‘Khong co’)
else for i:= 1 to length(s) do
if s[i]=’A’ then write(i,’ ‘);
readln;
End.
program vi_tri;
uses crt;
var s:string;
i:byte;
begin
clrscr;
write(‘Nhap xau: ‘); readln(s);
if pos(‘A’,s)=0 then write(‘Khong co’)
else for i:=1 to length(s) do
if s[i]=’A’ then write(i,’ ‘);
readln;
end.