Program for centered nonagonal number | Java Program to find nth centered nonagonal number . ; Function to find nth centered nonagonal number . ; Formula to find nth centered nonagonal number . ; Driver function .
import java . io . * ; class GFG { static int centeredNonagonal ( int n ) { return ( 3 * n - 2 ) * ( 3 * n - 1 ) / 2 ; } public static void main ( String args [ ] ) { int n = 10 ; System . out . println ( centeredNonagonal ( n ) ) ; } }