program SumNumbers;
varn, sum, i: integer;
beginsum := 0;
writeln('Enter a positive integer:');readln(n);
if n < 1 thenwriteln('Invalid input. Please enter a positive integer.')elsebeginfor i := 1 to n dosum := sum + i;
end.
program SumNumbers;
var
n, sum, i: integer;
begin
sum := 0;
writeln('Enter a positive integer:');
readln(n);
if n < 1 then
writeln('The sum of integers from 1 to ', n, ' is: ', sum);writeln('Invalid input. Please enter a positive integer.')
else
begin
for i := 1 to n do
sum := sum + i;
end;
end.