Generate a unique Array of length N with sum of all subarrays divisible by N | Java program for the above approach ; Function to print the required array ; Print the array ; Driver code
class GFG { static void makeArray ( int a [ ] , int n ) { for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( i * n + " ▁ " ) ; } public static void main ( String [ ] args ) { int N = 6 ; int arr [ ] = new int [ N ] ; makeArray ( arr , N ) ; } }