Answer to Question #162449 in Algorithms for Asaana

Question #162449

Write an algorithm and pseudocode to compute f(x)=1+x+x^2+x^3+....+x^n


1
Expert's answer
2021-02-10T01:08:03-0500
Algorithm 
Start
        Declare variable n
        Declare variable x
        Get n from the user
        Get x from the user
        Declare variable sum=1
        for i  = 1 to n step 1
            Find sum = sum + x^i
        next
        Display sum 
End

Pseudocode 
Start
        Set n = 0
        Set x = 0
        Get n from the user
        Get x from the user
        Set sum = 1
        for i = 1 to n
            sum = sum + x^i
        Display sum 
End

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
New on Blog
APPROVED BY CLIENTS