Octahedral Number | C ++ program to find nth octahedral number ; Function to find octahedral number ; Formula to calculate nth octahedral number ; Drivers code ; print result
#include <bits/stdc++.h> NEW_LINE using namespace std ; int octahedral_num ( int n ) { return n * ( 2 * n * n + 1 ) / 3 ; } int main ( ) { int n = 5 ; cout << n << " th ▁ Octahedral ▁ number : ▁ " ; cout << octahedral_num ( n ) ; return 0 ; }