Octahedral Number | C # program to find nth Octahedral number ; Function to find octahedral number ; Formula to calculate nth octahedral number and return it into main function . ; Driver Code ; print result
using System ; class GFG { static int octahedral_num ( int n ) { return n * ( 2 * n * n + 1 ) / 3 ; } static public void Main ( ) { int n = 5 ; Console . Write ( n + " th ▁ Octahedral " + " ▁ number : ▁ " ) ; Console . WriteLine ( octahedral_num ( n ) ) ; } }