Construct an Array such that cube sum of all element is a perfect square | Java program to construct 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
import java . util . * ; class GFG { static void constructArray ( int N ) { int arr [ ] = new int [ N ] ; for ( int i = 1 ; i <= N ; i ++ ) { arr [ i - 1 ] = i ; } for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( arr [ i ] + " , ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 6 ; constructArray ( N ) ; } }