Question: 1' nputNamel 2. 3. Squared @ Create a program in Flode that will accept a value, Store this value in a variable called N. The

 1' nputNamel 2. 3. Squared @ Create a program in Flode

1' nputNamel 2. 3. Squared @ Create a program in Flode that will accept a value, Store this value in a variable called N. The program will calculate the sum of each value of N squared from 0 up to and including N. In mathematical notation, this is written as 2101'? As an example if our input number is 3. the program should output 14. How is this derived? As we know loops are good With repetitive tasks, To get to 14 we need to do the following with each iteration of the loop: 1'1 2'2 3'3 +++w First let's analyze what is going on with our numbers, With each iteration, what do you notice? Are the numbers both increasing by one? Second. what are we doing with the product of our numbers? In other words during the rst iteration. we multiply O * 0. What do we do with this? In order to save this for the next iteration, we need to store this in a variable that allows us to accumulate the value for the next iteration, For instance when we write: counter : counter + 1 with each iteration of the loop, what is happening to counter? We can do the same with outer variables, Finally when does our loop stop? It stops when our loop counter gets to whatever number we entered. In our example that would be when the counter gets to 4 as 4 is not 3, ck ltl

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!