Sum of GP
Submissions: 4351   Accuracy:

16.85%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Write a Program to calculate the sum of n terms of a Geometric Progression when first term is a and common ratio is r.

Input: 
The first line of the input contains T denoting the number of testcases. The first line of the test case will be the number of terms of GP and second line contains first term and common ratio.

Output: 
For each test case the output will be the sum of n terms of GP.Print the answer upto 6 decimal places.

Constraints:
1 <= T<= 100
1 <= N <= 100
1 <= a,r <= 100

Example:
Input:
1
3
3 2

Output:
21.000000

** For More Input/Output Examples Use 'Expected Output' option **

Author: atharv


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.