Find the sum of the first N Dodecagonal Numbers | C ++ program to find the sum of the first N dodecagonal numbers ; Function to find the N - th dodecagonal number ; Formula to calculate N - th dodecagonal number ; Function to find the sum of the first N dodecagonal numbers ; Variable to get the sum ; Iterating through the first N numbers ; Compute the sum ; Driver Code ; Display first Nth centered_decagonal number
#include <bits/stdc++.h> NEW_LINE using namespace std ; int Dodecagonal_num ( int n ) { return ( 5 * n * n - 4 * n ) ; } int sum_Dodecagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += Dodecagonal_num ( i ) ; } return summ ; } int main ( ) { int n = 5 ; cout << ( sum_Dodecagonal_num ( n ) ) ; return 0 ; }