Hectagon Number | Java program for above approach ; Finding the nth hectagon Number ; Driver Code
import java . util . * ; class GFG { static int hectagonNum ( int n ) { return ( 98 * n * n - 96 * n ) / 2 ; } public static void main ( String args [ ] ) { int n = 3 ; System . out . print ( "3rd ▁ hectagon ▁ Number ▁ is ▁ = ▁ " + hectagonNum ( n ) ) ; } }