ответ:var
a, b, sum, i: LongInt;
begin
Write('a='); ReadLn(a);
repeat
Write('b='); ReadLn(b);
until (b > a);
sum := 0;
for i := a to b do
if (Not Odd(i))
then
Inc(sum, i);
WriteLn('sum=', sum);
sum := 0; i := a;
if (Odd(a))
Inc(i);
while (i <= b) do
Inc(i, 2);
end;
WriteLn('sum2=', sum);
until (i > b);
WriteLn('sum3=', sum);
end.
Объяснение:
ответ:var
a, b, sum, i: LongInt;
begin
Write('a='); ReadLn(a);
repeat
Write('b='); ReadLn(b);
until (b > a);
sum := 0;
for i := a to b do
if (Not Odd(i))
then
Inc(sum, i);
WriteLn('sum=', sum);
sum := 0; i := a;
if (Odd(a))
then
Inc(i);
while (i <= b) do
begin
Inc(sum, i);
Inc(i, 2);
end;
WriteLn('sum2=', sum);
sum := 0; i := a;
if (Odd(a))
then
Inc(i);
repeat
Inc(sum, i);
Inc(i, 2);
until (i > b);
WriteLn('sum3=', sum);
end.
Объяснение: