Find n | Function to find the nth term of series ; Loop to add numbers ; Driver code
< ? php function term ( $ n ) { $ ans = 0 ; for ( $ i = 1 ; $ i <= $ n ; $ i ++ ) $ ans += $ i ; return $ ans ; } $ n = 4 ; echo ( term ( $ n ) ) ; ? >