Hexadecagonal number | C ++ program to find Nth hexadecagon number ; Function to calculate hexadecagonal number ; Drivers Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int hexadecagonalNum ( long int n ) { return ( ( 14 * n * n ) - 12 * n ) / 2 ; } int main ( ) { long int n = 5 ; cout << n << " th ▁ Hexadecagonal ▁ number ▁ : ▁ " ; cout << hexadecagonalNum ( n ) ; cout << endl ; n = 9 ; cout << n << " th ▁ Hexadecagonal ▁ number ▁ : ▁ " ; cout << hexadecagonalNum ( n ) ; return 0 ; }