Program for sum of arithmetic series | Function to find sum of series . ; Driver Code
< ? php function sumOfAP ( $ a , $ d , $ n ) { $ sum = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ sum = $ sum + $ a ; $ a = $ a + $ d ; } return $ sum ; } $ n = 20 ; $ a = 2.5 ; $ d = 1.5 ; echo ( sumOfAP ( $ a , $ d , $ n ) ) ; ? >