Program to calculate sum of an Infinite Arithmetic | Function to find the sum of the infinite AGP ; Stores the sum of infinite AGP ; Print the required sum ; Driver Code
function sumOfInfiniteAGP ( a , d , r ) { let ans = a / ( 1 - r ) + ( d * r ) / ( 1 - r * r ) ; document . write ( ans ) } let a = 0 , d = 1 , r = 0.5 ; sumOfInfiniteAGP ( a , d , r ) ;