Write algorithm for the sum of f(x)=1+x+x^2+x^3+...+x^n
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?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments
Leave a comment