Цитата:
Сообщение от Svetlanka
помогите пжл!!!!!!!!
|
Пжл:
Код:
VAR
S,SS:String;
St:ARRAY[1..127] of String;
Cnt,N,N5:Byte;
i,pos:Integer;
Code:Word;
Num:LongInt;
BEGIN
WriteLn('Enter the string:');
ReadLn(S);
N:=0;
i:=0;
pos:=1;
Cnt:=0;
REPEAT
Inc(N);
Repeat
Inc(i);
If S[i]<>' ' then Inc(Cnt);
Until (S[i]=' ') or (i=Length(S));
St[N]:=Copy(S,pos,Cnt);
If i<Length(S) then
begin
Repeat
Inc(i);
Until S[i]<>' ';
pos:=i;
Cnt:=1;
end;
UNTIL i=Length(S);
WriteLn('There are ',N,' words in the string');
N5:=0;
For i:=1 to N do
begin
VAL(St[i],Num,Code);
If (Code=0) and ((Num mod 5)=0) then
Inc(N5);
end;
WriteLn('There are ',N5,' numbers divisible by 5');
ReadLn;
END.