I know that it is not the right place to ask , still I need it badly
First of all please remember that this is not an IIT problem or challenge that I have posted earlier .
I am currently working on my thesis paper for my 2nd year engg. course . ( meant to be submitted as early as possible , e.g. by August )
Now , all the necessary algorithms and calculations have already been worked out by me but at one place I have got stuck ......................
To numerically simulate my algorithm , I need a solution of the following problem .
suppose x1, x2 , .....xm are variables that take integer values in the range 0 to ( k-1 ) ,
Now list all the possible solution of the eqn
x1 + x2 + .............. + xm = k
I need a code ( or mere algorithm would also suffice ) that take the values of (k and m ) during runtime from the user and displays ALL the possible solutions on the screen .
Plz help me !!
Plz note that a brute force solution is also acceptable as I don't need to submit the program !!
The tricky business that is present here is to run a variable no of 'for' loops . Give it a try .