Var R,A:real; S:string; i,z,L:integer; Begin Read(S); S:=' '+S; L:=Length(S); i:=1; R:=0; Repeat Case S[i] of '0'..'9': Begin A:=0; if S[i-1]='-' then z:=1 else z:=0; While (S[i]in['0'..'9'])and(i<L) do Begin A:=A*10+StrToInt(S[i]); i:=i+1 End; if (i=L)and(S[i]in['0'..'9']) then A:=A*10+StrToInt(S[i]); if z=0 then R:=R+A else R:=R-A; End; End; i:=i+1 Until i>L; WriteLn('Сумма чисел в строке: ',R) End.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку