Dodecahedral number | Java program to find nth dodecahedral number ; Function to find dodecahedral number ; Formula to calculate nth dodecahedral number and return it into main function . ; Driver Code ; print result
import java . io . * ; class GFG { static int dodecahedral_num ( int n ) { return n * ( 3 * n - 1 ) * ( 3 * n - 2 ) / 2 ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . print ( n + " the ▁ Dodecahedral " + " ▁ number : " ) ; System . out . println ( dodecahedral_num ( n ) ) ; } }