12+22+32+42 = 1+4+9+16 = 30
That supposed to be 1²+2²+3²+4² = 1+4+9+16 = 30
I'm just new in C++ and I can't get the exact code for that using the three statements.
1. Prompt for the number.
2. Write a for loop in which set first condition to 0 and second to n.
3. Square a variable(say j) initially set to 0 and add it to the another variable(say sum).
4. increment the variable(j).
5. print the sum when out of for loop.
Agreed with Athar...
It is not that difficult to create a program once you get the algorithm. Focus on learning. I am sure you will start writing such easy programs within a week...
Sorry, but I don't have a programming class. I only study with my own, no one is teaching me. NO examples, NO explanations at all. I'm just reading on the internet and trying to have a guide. It's ok if no one can help me.