Answer to Question #162454 in Algorithms for Asaana

Question #162454

Write algorithm for the sum of f(x)=1+x+x^2+x^3+...+x^n


1
Expert's answer
2021-02-12T01:39:49-0500

Pseudocode:

INIT x, n

SET term:=1, sum:=1

WHILE n>0

term := term * x

sum := sum + term

n := n - 1

ENDWHILE

PRINT sum


Flowchart:

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS