Find the nth term of the series 0 , 8 , 64 , 216 , 512 , . . . | Java implementation of the approach ; Function to return the nth term of the given series ; Common difference and first term ; First term ; nth term ; nth term of the given series ; Driver code
import java . util . * ; import java . lang . * ; import java . io . * ; public class GFG { static int nthTerm ( int n ) { int d = 2 ; int a1 = 0 ; int An = a1 + ( n - 1 ) * d ; return ( int ) Math . pow ( An , 3 ) ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( nthTerm ( n ) ) ; } }