Geometric Progression Series Python

PROGRAM TO PRINT GEOMETRIC PROGRESSION SERIES


def printGP(a, r, n): 
    for i in range(0, n): 
        curr_term = a * pow(r, i)
        print(curr_term, end =" ")
  
a = 2 # starting number
r = 3 # Common ratio
n = 5 # N th term to be find
  
printGP(a, r, n)


OUTPUT
2 6 18 54 162

Comments

Popular posts from this blog

Solve the Sudoku Python

Solve the Sudoku Java

Find Duplicates Java