program name;
uses crt;
var str: string;
i, count: integer;
begin
write('Текст : ');readln(str);
i := length(str);
if i > 0 then begin
count := 1;
while i > 0 do begin
if str[i] = ' ' then
count := count + 1;
i := i - 1;
end;
end
else
count := 0;
writeln('Кол-во строк в тексте: ', count);
readln;
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
program name;
uses crt;
var str: string;
i, count: integer;
begin
write('Текст : ');readln(str);
i := length(str);
if i > 0 then begin
count := 1;
while i > 0 do begin
if str[i] = ' ' then
count := count + 1;
i := i - 1;
end;
end
else
count := 0;
writeln('Кол-во строк в тексте: ', count);
readln;
end.