Home » Ask & Discuss » Mathematics. » Algebra « Back to Discussion



Algebra

abhishek sinha's Avatar
Forum Expert
Joined: 18 Dec 2007
Post: 926
20 Jun 2008 21:19:57 IST
0 People liked this
2
606 View Post
A simple problem to solve - Feynmann
None

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 .


 


Share this article on:

Comments (2)

akshay A NEW BEGINNING...'s Avatar

Blazing goIITian

Joined: 25 Dec 2007
Posts: 1104
21 Jun 2008 10:20:46 IST
0 people liked this

u want codes of C++ or java????

i have worked it out  by making a functions in C++

however it will not work for certain exceptions but it can help u

so if u want the code of C++ i can give u.

abhishek sinha's Avatar

Forum Expert
Joined: 18 Dec 2007
Posts: 926
21 Jun 2008 20:42:42 IST
0 people liked this

Yeah !!! Please post it !!


Thank you in anticipation .




Quick Reply


Reply

Some HTML allowed.
Keep your comments above the belt or risk having them deleted.
Signup for a avatar to have your pictures show up by your comment
If Members see a thread that violates the Posting Rules, bring it to the attention of the Moderator Team
Free Sign Up!

Preparing for IIT-JEE ?

Arihant Revision Package for IIT JEE - Books, Practice Tests + Rank Predictor


@ INR 1,995/-

For Quick Info

Name

Mobile No.

Find Posts by Topics

Physics.

Topics

Mathematics.

Chemistry.

Biology

Parents

Board

Fun Zone

Sponsored Ads