Hexadecagonal number | Java program to find Nth hexadecagon number ; Function to calculate hexadecagonal number ; Drivers Code
import java . io . * ; class GFG { static long hexadecagonalNum ( long n ) { return ( ( 14 * n * n ) - 12 * n ) / 2 ; } public static void main ( String [ ] args ) { long n = 5 ; System . out . println ( n + " th ▁ " + " Hexadecagonal ▁ number ▁ : ▁ " + hexadecagonalNum ( n ) ) ; n = 9 ; System . out . println ( n + " th ▁ " + " Hexadecagonal ▁ number ▁ : ▁ " + hexadecagonalNum ( n ) ) ; } }