
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
Sum of series 1^2 + 3^2 + 5^2 + . . . + (2*n – 1)^2
A series is a sequence of numbers that have some common traits that each number follows. These mathematical series are defined based on some mathematical logic like every number increases by the same interval( arithmetic progression), every number is increased by the same multiple( geometric progression), and many other patterns.
To find the sum of a series we need to evaluate the series and make a general formula for it. But in the series that is no common declaration that takes place so we have to go through the classical approach by adding each number of the series to a sum variable.
Let's take an example that will make the logic more clear,
sum of series upto 7
sum(7) = 12 + 22 + 32 + 42 + 52 + 62 + 72 = 455
Example
#include <stdio.h> int main() { int i, n, sum=0; n=17 ; for ( i = 1; i <= n; i++) { sum = sum + (2 * i - 1) * (2 * i - 1); } printf("The sum of series upto %d is %d", n, sum); }
Output
The sum of series upto 17 is 6545
- Related Articles
- Sum of series 1^2 + 3^2 + 5^2 + . . . + (2*n - 1)^2 in C++
- Sum of the series 1 + (1+2) + (1+2+3) + (1+2+3+4) + ... + (1+2+3+4+...+n) in C++
- Sum of the series 1 / 1 + (1 + 2) / (1 * 2) + (1 + 2 + 3) / (1 * 2 * 3) + … + upto n terms in C++
- Sum of the Series 1/(1*2) + 1/(2*3) + 1/(3*4) + 1/(4*5) + ... in C++\n
- Find Sum of Series 1^2 - 2^2 + 3^2 - 4^2 ... upto n terms in C++
- Sum of the series 1^1 + 2^2 + 3^3 + ... + n^n using recursion in C++
- Sum of the series 2^0 + 2^1 + 2^2 +...+ 2^n in C++
- C++ program to find the sum of the series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + … + (n*n)
- C++ program to find the sum of the series 1 + 1/2^2 + 1/3^3 + …..+ 1/n^n
- Sum of the Series 1 + x/1 + x^2/2 + x^3/3 + .. + x^n/n in C++
- Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + .. + n in C++
- Python Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
- C++ Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! + …… n/n!
- C++ program to find the sum of the series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
- Java Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!

Advertisements