Heptagonal number | Java program to find the nth Heptagonal number ; Function to return Nth Heptagonal number ; Driver Code
import java . io . * ; class GFG { static int heptagonalNumber ( int n ) { return ( ( 5 * n * n ) - ( 3 * n ) ) / 2 ; } public static void main ( String [ ] args ) { int n = 2 ; System . out . println ( heptagonalNumber ( n ) ) ; n = 15 ; System . out . println ( heptagonalNumber ( n ) ) ; } }