Sum of an Infinite Geometric Progression ( GP ) | Function to calculate the sum of an infinite Geometric Progression ; Case for Infinite Sum ; Store the sum of GP Series ; Print the value of sum ; Driver Code
function findSumOfGP ( a , r ) { if ( Math . abs ( r ) >= 1 ) { document . write ( " " ) ; return ; } let sum = a / ( 1 - r ) ; document . write ( sum ) ; } let A = 1 , R = 0.5 ; findSumOfGP ( A , R ) ;