program SumOfArithmeticProgression;
varfirstElement, difference, numberOfElements, sum: integer;i: integer;
beginsum := 0;
write('Enter the first element of the arithmetic progression: ');readln(firstElement);
write('Enter the difference of the arithmetic progression: ');readln(difference);
write('Enter the number of elements in the arithmetic progression: ');readln(numberOfElements);
for i := 1 to numberOfElements dobeginsum := sum + firstElement + (i - 1) * difference;end;
writeln('The sum of the elements in the arithmetic progression is: ', sum);
end.
program SumOfArithmeticProgression;
var
firstElement, difference, numberOfElements, sum: integer;
i: integer;
begin
sum := 0;
write('Enter the first element of the arithmetic progression: ');
readln(firstElement);
write('Enter the difference of the arithmetic progression: ');
readln(difference);
write('Enter the number of elements in the arithmetic progression: ');
readln(numberOfElements);
for i := 1 to numberOfElements do
begin
sum := sum + firstElement + (i - 1) * difference;
end;
writeln('The sum of the elements in the arithmetic progression is: ', sum);
end.