# algorithm

posted by .

can someone tell me if this is correct.
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 -

Your 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!

## Similar Questions

1. ### Computer Science

1.Write an Assembly program that reads in a number of cents. The program will write out the number of dollars and cents separately. Sample Run: ?
2. ### Algorithm

write a pseudo code algorithm that will accept the marks in a test for a group of 25 students then calculate and display the average mark
3. ### programming

1. Write a structured algorithm that prompts the user to input two numbers. The algorithm should calculate and print the sum & product of the two numbers [21/2]
4. ### Quantum Computing

In this problem, we will carry out some steps of the quantum factoring algorithm for N=21. (a) What is the period k of the periodic superposition set up by the quantum factoring algorithm if it chooses x=2?
5. ### Algorithm

Pkease who can help? I need to know a pseudocode to display the first n positive integers given n from the user. here is what i tried PROMPT “Please enter n” GET n IF n==1 then DISPLAY “1” WHILE n>1 COMPUTE intiger=n-(n-1)
6. ### computer

Write an algorithm for a program that accepts a set of numbers and finds the smallest among them and computes the sum of the numbers accepted. The program stops when the user enters number 999. Convert the algorithm into flowchart
7. ### Program

Write a pseudocode and algorithm that to else the user to input 10 numbers in program we display the largest number
8. ### pseudo code algorithm

Write a pseudo code algorithm which: • Determines the average weight of a person over a particular year. • For each month, your algorithm should input the person's weight for that month (a positive real number). Your algorithm …
9. ### ICT

Indicate the variables used, draw an IPO chart and write an algorithm to solve the problem. Test your algorithm by doing a trace table. • Enter the number of rows of tables in the city hall as well as the number of Tables per row. …
10. ### Mathis

wRite a peudocode,algorithm and draw flowchart that display the sum of all even number between 0 and 100

More Similar Questions