text: Program to find Nth term of the series 3 , 6 , 18 , 24 , ... | Function to calculate Nth term of series ; By using abeove formula ; get the value of nthTerm ; Calculate and print the Nth term
code: < ? php function nthTerm ( $ N ) { return ( $ N * ( ( int ) ( $ N / 2 ) + ( ( $ N % 2 ) * 2 ) + $ N ) ) ; } $ N = 5 ; echo " Nth ▁ term ▁ for ▁ N ▁ = ▁ " , $ N , " ▁ : ▁ " , nthTerm ( $ N ) ; ? >