Sum of first n even numbers | function to find sum of first n even numbers ; required sum ; Driver Code
< ? php function evenSum ( $ n ) { return ( $ n * ( $ n + 1 ) ) ; } $ n = 20 ; echo " Sum ▁ of ▁ first ▁ " , $ n , " ▁ Even ▁ numbers ▁ is : ▁ " , evenSum ( $ n ) ; ? >