Octadecagonal Number | Java program to find Nth octadecagonal number ; Function to find N - th octadecagonal number ; Formula to calculate nth octadecagonal number ; Driver code
import java . io . * ; import java . util . * ; class GFG { static int Octadecagonal_num ( int n ) { return ( 16 * n * n - 14 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( Octadecagonal_num ( n ) ) ; n = 10 ; System . out . println ( Octadecagonal_num ( n ) ) ; } }