program SumAverage;
varnum, sum, count: Integer;avg: Real;
beginsum := 0;count := 0;
writeln('Enter numbers (press 0 to finish):');
repeatreadln(num);sum := sum + num;count := count + 1;until num = 0;
count := count - 1; // exclude 0 from count
if count > 0 thenbeginavg := sum / count;writeln('Sum: ', sum);writeln('Average: ', avg:0:2);endelsewriteln('No numbers entered.');
end.
program SumAverage;
var
num, sum, count: Integer;
avg: Real;
begin
sum := 0;
count := 0;
writeln('Enter numbers (press 0 to finish):');
repeat
readln(num);
sum := sum + num;
count := count + 1;
until num = 0;
count := count - 1; // exclude 0 from count
if count > 0 then
begin
avg := sum / count;
writeln('Sum: ', sum);
writeln('Average: ', avg:0:2);
end
else
writeln('No numbers entered.');
end.