Python Program to input N number and print sum of N geometric terms

 




# sum = a + ar + ar**2 + ar**3 + ..... + ar**n


n= int (input ('Enter no of terms'))

a= int (input ('Enter value for a '))

r= int (input ('Enter value for r'))

sum=a

for i in range (1,n+1):

    sum = sum + (a*r**i)

    print (a*r**i, sum)

print ('Sum of series = ',sum)

Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.

Python Program which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.The numbers obtained should be printed in a comma-separated sequence on a single line