/***********************************************************
GS_Program2.ch
Geometric Series
This program, once finished, will calculate various properties
of a geometric series when given the first, second and number of
terms of the series which is why it is different from GS_Program1.ch
***********************************************************/
//Initialize variables
double first, second, last, enter, ratio, product, difference, sum;
int n;
//get the terms
printf("enter the first term of the geometric series: ");
scanf("%lf", &first);
printf("enter the second term of the geometric series: ");
scanf("%lf", &second);
printf("enter the number of terms in the geometric series: ");
scanf("%d", &n);
//calculations
ratio = second/first;
//last = ______________;
product = last*ratio;
difference = first - product;
sum = difference/(1 - ratio);
//display results
printf("ratio: %.2lf", ratio);
printf("last term: %lf", last);
printf("sum: %.2lf", sum);