Generate a unique Array of length N with sum of all subarrays divisible by N | C ++ implementation of the above approach ; Function to print the required array ; Print the array ; Driver Program
#include <bits/stdc++.h> NEW_LINE using namespace std ; void makeArray ( int a [ ] , int n ) { for ( int i = 1 ; i <= n ; i ++ ) cout << i * n << " ▁ " ; } int main ( ) { int N = 6 ; int arr [ N ] ; makeArray ( arr , N ) ; }