This C++ program will find the sum of square of n natural numbers.

For example:

n = 3

Then, Sum = 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#include<iostream> using namespace std; int main() { unsigned long n,i,sum=0,d; cout<<"Enter any number:"; cin>>n; for(i=1;i<=n;++i) { d=i*i; sum+=d; } cout<<"Sum="<<sum; return 0; } |

**Output**

Enter any number: 50

Sum=42925

tamanna vermaVery gd I understand very good

alanThe provided code is very useful.will you please provide the same code using do while loop

Alphy Rose CyrilThe code provided was useful in correcting the code i had written. Could you please provide the Algorithm for this program?

Thanks in advance!!

RaihanaIn while loop

Find the sum of square of first N natural numbers

C++ program please send this program?

RaihanaPlease reply

kiran unnisthis is very useful thanks