program SumRepeatUntil;
varsum, i: Integer;
beginsum := 0;i := 1;
repeatsum := sum + i;i := i + 1;until i > 100;
WriteLn('Sum of numbers from 1 to 100:', sum);WriteLn('Average: ', sum / 100:0:2);end.
program SumWhileDo;
while i <= 100 dobeginsum := sum + i;i := i + 1;end;
program SumForTo;
beginsum := 0;
for i := 1 to 100 dobeginsum := sum + i;end;
program SumRepeatUntil;
var
sum, i: Integer;
begin
sum := 0;
i := 1;
repeat
sum := sum + i;
i := i + 1;
until i > 100;
WriteLn('Sum of numbers from 1 to 100:', sum);
Программа с использованием цикла While..Do:WriteLn('Average: ', sum / 100:0:2);
end.
program SumWhileDo;
var
sum, i: Integer;
begin
sum := 0;
i := 1;
while i <= 100 do
begin
sum := sum + i;
i := i + 1;
end;
WriteLn('Sum of numbers from 1 to 100:', sum);
Программа с использованием цикла For..to:WriteLn('Average: ', sum / 100:0:2);
end.
program SumForTo;
var
sum, i: Integer;
begin
sum := 0;
for i := 1 to 100 do
begin
sum := sum + i;
end;
WriteLn('Sum of numbers from 1 to 100:', sum);
WriteLn('Average: ', sum / 100:0:2);
end.