First, write the equation for the sum of the arithmetic progression with difference d=1 and the first element a1=1:
The sum must be greater than 500:
transform the inequality:
Algorithm:
for int n=1 to infinity:
if n^2+n-1000<0,
then continue
else print(n)
Draw the flow diagram:
Comments
Leave a comment