Ответ:
program CountChar;
var
s: string;
c: Char;
i, count: Integer;
begin
Write ('Введите строку: ');
ReadLn (s);
Write ('Введите символ: ');
ReadLn (c);
count := 0;
for i := 1 to Length (s) do begin
if s [i] = c then
Inc (count);
end;
WriteLn ('В строке ', count, ' символов "', c, '"');
ReadLn;
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
Ответ:
program CountChar;
var
s: string;
c: Char;
i, count: Integer;
begin
Write ('Введите строку: ');
ReadLn (s);
Write ('Введите символ: ');
ReadLn (c);
count := 0;
for i := 1 to Length (s) do begin
if s [i] = c then
Inc (count);
end;
WriteLn ('В строке ', count, ' символов "', c, '"');
ReadLn;
end.