You can win three kinds of basketball points, 1 point, 2 points, and 3 points. Given a total score n, print out all the combination to compose n
At first position we can have three numbers 1 or 2 or 3. First put 1 at first position and recursively call for n-1. Then put 2 at first position and recursively call for n-2. Then put 3 at first position and recursively call for n-3.#define MAX_POINT 3voidprintArray(intarr[],intarr_size);void printCompositions(int n, int i) { static int arr[ARR_SIZE]; if (n == 0) { printArray(arr, i); } else if(n > 0) { int k; for (k = 1; k <= MAX_POINT; k++) { arr[i]= k; printCompositions(n-k, i+1); } } }