Program for sum of arithmetic series | Efficient solution to find sum of arithmetic series . ; Driver code
function sumOfAP ( a , d , n ) { let sum = ( n / 2 ) * ( 2 * a + ( n - 1 ) * d ) ; return sum ; } let n = 20 ; let a = 2.5 , d = 1.5 ; document . write ( sumOfAP ( a , d , n ) ) ;