## Saturday, 26 December 2015

### Geometric Progression - Write A Program To Find SUM of GP Sequence -C Programming Examples

As we have started C Programming coding with Example Series, We have published last post Write A Program To Find SUM of AP. We have chosen to start with mathematical series and in this post you will find some basic idea and some useful concepts about Geometric Progression (G.P.).You can download C Codes below.Please let us know your feedback.

Integrated Environment : TURBO C/C++ - Getting Started
TURBO C/C++: Installer and Installation
C Language Programming With Examples-INDEX

Arithmetic Progression Step-wise Video Tutorial(See C- Codes Below ):

Geometric Progression Basic Guide:-A sequence of non-zero numbers is a Geometric Progression (G.P.) if the ratio of any term and its preceding term is always constant.

A Geometric Progression (G.P.) is given by a, ar, ar2, ar3, ...
where a = the first term , r = the common ratio

Examples for Geometric Progressions
1, 3, 9, 27, ... is a geometric progression (G.P.) with a = 1 and r = 3

2, 4, 8, 16, ... is a geometric progression (G.P.) with a = 2 and r = 2

Nth term of a geometric progression (G.P.)

Sum of first N terms in a geometric progression (G.P.)

Sum of an infinite geometric progression (G.P.)
Geometric Mean of an Geometric Progression (G.P.)

Write A Program In C To Find SUM of Geometric Progression-Series- Sequence:

C Codes are written and tested in TuboC/C++ IDE as you can see in Video:

#include<stdio.h>

int main(){

float a,r;
float sum=0;

printf("Enter the first number of the G.P. series: ");
scanf("%f",&a);

printf("Enter the common ratio of G.P. series: ");
scanf("%f",&r);

if(1 > r)
sum = a/(1-r);
else
sum = a/(r-1);

printf("\nSum of the infinite G.P. series: %f\n\n",sum);
delay(5000);
return 0;

}