How to write a program that output the number of different ways of arranging the number so that the displayed numbers add up to a fixed sum inputed byt the used.
For example, suppose the sum is 4. There are 8 different arrangements. It has to be listed in dictionary order.
1 1 1 1
1 1 2
1 2 1
1 3
2 1 1
2 2
3 1
4