Var a,b:real; begin write('a, b: '); readln(a,b); writeln(a,' + ',b,' = ',a+b); if a+b<1 then if a<b then a:=(a+b)/2 else b:=(a+b)/2 else if a<b then a:=a+b else b:=a+b; writeln('a = ',a,' b = ',b); end.
Пример: a, b: -2.8 4.5 -2.8 + 4.5 = 1.7 a = 1.7 b = 4.5
begin
write('a, b: ');
readln(a,b);
writeln(a,' + ',b,' = ',a+b);
if a+b<1
then if a<b then a:=(a+b)/2 else b:=(a+b)/2
else if a<b then a:=a+b else b:=a+b;
writeln('a = ',a,' b = ',b);
end.
Пример:
a, b: -2.8 4.5
-2.8 + 4.5 = 1.7
a = 1.7 b = 4.5