Question: Exercise 3 . 2 a Pyramid Number Problem A pyramidal number has the form 1 ^ 2 + 2 ^ 2 + 3 ^ 2

Exercise 3.2a Pyramid Number Problem
A pyramidal number has the form 1^2+2^2+3^2+.......
for example the forth pyramidal number is 30 because:
1^2+2^2+3^2^4^2=1+4+9+16=30
It is also known as the cannonball stacking number becasue it represents how much spherical cannonballs
can be stacked in a pyramid shape with a given number of rows.
Your program should:
1) Ask the user how many rows of cannonballs they want to stack
2) Calculate the total number of cannonballs that will create the pyramid with the specified rows

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!