text: Construct an Array such that cube sum of all element is a perfect square | C ++ program to construct an array that cube sum of all element is a perfect square ; Function to create and print the array ; initialise the array of size N ; Print the array ; Driver code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; void constructArray ( int N ) { int arr [ N ] ; for ( int i = 1 ; i <= N ; i ++ ) { arr [ i - 1 ] = i ; } for ( int i = 0 ; i < N ; i ++ ) { cout << arr [ i ] << " , ▁ " ; } } int main ( ) { int N = 6 ; constructArray ( N ) ; return 0 ; }