Program for sum of arithmetic series | Function to find sum of series . ; Driver function
function sumOfAP ( a , d , n ) { let sum = 0 ; for ( let i = 0 ; i < n ; i ++ ) { sum = sum + a ; a = a + d ; } return sum ; } let n = 20 ; let a = 2.5 , d = 1.5 ; document . write ( sumOfAP ( a , d , n ) ) ;