###
C++ Program To Find Sum Of Given Series 1^2+3^2+5^2+ . . . . n^2

**Problem :- **Write A C++ Program To Find Sum Of Series 1^2+3^2+5^2+ . . . . n^2

**Logic :- **In This series loop initialize with zero and increase by 2 cause we have to find the sum of the power of 2 odd number so first print odd number then power of 2 after that sum .
i+=2 ( increase by 2 )

i*i ( Power of 2 )

sum+=(i*i); ( sum of odd )

Try Yourself C++ Program To Find Sum Of Series 1+x^1+x^2+x^3+ . . . . . x^n

**Solution :-**

#include<iostream>

using namespace std;

int main()

{

//By-Ghannedra Yadav

int n,i;

long sum=0;

cout<<"1^2+3^2+5^2+……+n^2\n\nEnter Value of N :\n";

cin>>n;

for(i=1;i<=n;i+=2)

{

sum+=(i*i);

}

cout<<"\nSum of given series is = "<<sum<<endl;

return 0;

}

**Output:-**

### Share This Article With Your Friends

Recommended Posts For You

**Extreme Recommended:-** Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to **Subscribe**. Enter your Email and click to subscribe.

#### Don't Miss Another Article

Join over **20,000+** people who get FREE and fresh content every month from this Blog. I Respect Privacy, You're Safe! No Spam!

#### Ghanendra Yadav

Hello, I Am **Ghanendra Yadav** Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From **NIT Warangal**. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours
Email:-
**yghanendra@student.nitw.ac.in**

## No comments:

## Post a Comment