Дано вещественное число A и целое число N (> 0). Вывести 1 + A + A2 + A3 + ... + An.
var
A, Summ:real;
N, i:integer;
begin
Summ := 1;
write('a = '); readln(a);
write('n = '); readln(n);
for i := 1 to n do
Summ := Summ + A * i;
writeln('Summ = ', Summ);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var
A, Summ:real;
N, i:integer;
begin
Summ := 1;
write('a = '); readln(a);
write('n = '); readln(n);
for i := 1 to n do
Summ := Summ + A * i;
writeln('Summ = ', Summ);
end.