Dodecahedral number | C ++ 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; int dodecahedral_num ( int n ) { return n * ( 3 * n - 1 ) * ( 3 * n - 2 ) / 2 ; } int main ( ) { int n = 5 ; cout << n << " th ▁ Dodecahedral ▁ number : ▁ " ; cout << dodecahedral_num ( n ) ; return 0 ; }