Monday

March 2, 2015

March 2, 2015

Posted by **alberto** on Thursday, July 17, 2008 at 10:13pm.

Write an algorithm that will display the sum for a given number of squares. In other words if the user enters the value 5, then the output should be 1^2 + 2^2 + 3^2 +4^2 + 5^2 = 55.

sumsquare integer

square integer

count integer

sumsquare := (y^2)

square := 1^2

count := 1

dowhile count = (x)

count = count + 1

sumsquare = sumquare + square

enddo

print\n "sumsquare is ", sumsquare

- algorithm -
**drwls**, Friday, July 18, 2008 at 8:16amYour algorithm is probably OK, but where do you enter the value 5 for the number of terms?

This same problem popped up about 4 days ago, but not as a computer problem. It turns out that same series sum can be written

(1/3)n^3 + (1/2)n^2 + (1/6)n

Where n is the number of terms in the series. Try it!

**Answer this Question**

**Related Questions**

programming - 1. Write a structured algorithm that prompts the user to input two...

Algorithm - write a pseudo code algorithm that will accept the marks in a test ...

Quantum Computing - In this problem, we will carry out some steps of the quantum...

programming - Write an algorithm that converts a decimal number to binary. Then...

physics - n this problem, we will carry out some steps of the quantum factoring ...

Quantum Physics - In this problem, we will carry out some steps of the quantum ...

sheba universty collage - design an algorithm that keeps on reading numbers ...

programming - Create the logic for a program that continuously prompts a user ...

programming pseudocode - Create the logic for a program that continuously ...

programming - Pseudocode - Create the logic for a program that continuously ...