nth term of a gp code example
Example: nth term of gp
The nth term of a GP is Tn = arn-1. Common ratio = r = Tn/ Tn-1. The formula to calculate the sum of the first n terms of a GP is given by: Sn = a[(rn-1)/(r-1)] if r ≠ 1and r > 1. Sn = a[(1 – rn)/(1 – r)] if r ≠ 1 and r < 1.