Find Nth term of series 1 , 4 , 15 , 72 , 420. . . | Java program to find N - th term of the series : 1 , 4 , 15 , 72 , 420 ; Function to find factorial of N ; base condition ; use recursion ; calculate Nth term of series ; Driver Code
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int factorial ( int N ) { if ( N == 0 N == 1 ) return 1 ; return N * factorial ( N - 1 ) ; } static int nthTerm ( int N ) { return ( factorial ( N ) * ( N + 2 ) / 2 ) ; } public static void main ( String args [ ] ) { int N = 6 ; System . out . println ( nthTerm ( N ) ) ; } }