// Pascal
var f, x: integer;
a, b, d: integer;
begin
a := 1;
b := 15;
d := 2;
for x := a to b do
writeln(x:4, (power(x, 3) + 2 * x):10);
end.
# Python
a = -50
b = 100
d = 2
for x in range(a, b + 1, d):
f = x ** 3 + 2 * x
print(f"{str(x).rjust(5, ' ')} {f}")
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
// Pascal
var f, x: integer;
a, b, d: integer;
begin
a := 1;
b := 15;
d := 2;
for x := a to b do
writeln(x:4, (power(x, 3) + 2 * x):10);
end.
# Python
a = -50
b = 100
d = 2
for x in range(a, b + 1, d):
f = x ** 3 + 2 * x
print(f"{str(x).rjust(5, ' ')} {f}")