Write a program that computes the sum of squares for a sequence of positive whole numbers. The program asks the user to enter the starting number. Then it asks the user to enter an ending number. It computes the square for each number from the starting number to the ending number. It also calculates the sum of these squares. It displays the numbers, their squares and the sum of the squares.

Answers

Answer 1

Answer:

In Python:

start = int(input("Start: "))

end = int(input("End: "))

total = 0

print("Number\t Squares")

for num in range(start,end+1):

   print(num,"\t",num**2)

   total+=num**2

print("Total: ",total)

Explanation:

This gets the starting number

start = int(input("Start: "))

This gets the ending number

end = int(input("End: "))

This initializes total to 0

total = 0

This prints the header

print("Number\t Squares")

This iterates through start to end

for num in range(start,end+1):

This prints each number and its square

   print(num,"\t",num**2)

This calculates the total squares

   total+=num**2

This prints the calculated total

print("Total: ",total)


Related Questions

Other Questions
A triangle has angles measuring 18.3 and 102.5. What is the measure of the third angle? Why were African tribes, colonies, and countries easy to conquer? Solve the equations: 3x+5 = 2(x+1)-5 PLSSSS HELP ME ALOT OF CREDITS AND BRAINLIST IF YOU HELP ME!!!!! Please no links they are not workingWhich climate experiences the greatest range in temperature?A. TaigaB. DesertC. Tropical RainforestD. Desert and Taiga What is the final volume of a 3.5M NaOH solution if the original solution was 20mL of a 7.00M NaOH solution Discuss the similarities and differences between whale flippers and flukes and fish fins, using the scientific terms "homologous structures" and "analogous structures" in the discussion. Solve the inequality for x8^x>24 write down the temperature which is 5 degree below -2 im crying please help me so much All of the following are reasons for countries to participate in foreign trade EXCEPTA. it is just as easy to start a business overseas as it is in the United States.B. no nation can produce all of the products its people want and need.C. even if a country was self-sufficient, other nations would seek to trade with that country in order to meet the needs of its own people.D. some nations have resources, but not technological know-how; while others have know-how, but lack resources. SOMEBODY HELP ME PLEASEEEEEEE I HAVE 9 more i need help with #8, #10 please! whoever helps me, ill give brainliest In your experience, do you think going to schoolonline has been easier or more difficult forstudents and their families? FindSin 2 (30degrees) Estructura correcta de los siguientes compuestos e indique si el nombre est escrito de forma correcta; 1,4-ciclohexadieno how to simplify 12 16 is 63 even or oddis 30 even or oddis 434 even or oddis 898 even or oddis 96 even or odd PLZ HELL FAST WILL GIVE BRAINLIEST Select all the correct equations.Which equations have no real solution but have two complex solutions?3x^2- 5x= -82x^2= 6x 512x= 9x^2 + 4-x^2 10x = 34 What's the word called for when people don't believe in ghosts or any type of things , there was a specific word !