Sum of first N Star Numbers | C ++ program to find the sum of the first N star numbers ; Function to find the sum of the first N star number ; Variable to store the sum ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int sum_star_num ( int n ) { int summ = 2 * n * ( n + 1 ) * ( n - 1 ) + n ; return summ ; } int main ( ) { int n = 3 ; cout << sum_star_num ( n ) ; return 0 ; }