subject
Engineering, 25.02.2020 16:59 Savy8595

SOLVE IN C: Brute force equation solver

Numerous engineering and scientific applications require finding solutions to a set of equations. Ex: 8x + 7y = 38 and 3x - 5y = -1 have a solution x = 3, y = 2. Given integer coefficients of two linear equations with variables x and y, use brute force to find an integer solution for x and y in the range -10 to 10.

Ex: If the input is:

8 7 38
3 -5 -1
then the output is:

3 2
Use this brute force approach:

For every value of x from -10 to 10
For every value of y from -10 to 10
Check if the current x and y satisfy both equations. If so, output the solution, and finish.
Ex: If no solution is found, output:

No solution
You can assume the two equations have no more than one solution.

Note: Elegant mathematical techniques exist to solve such linear equations. However, for other kinds of equations or situations, brute force can be handy.

ansver
Answers: 3

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 19:10, phantomlizz3233
In general, how do thermosetting plastics compare to thermoplastics in mechanical and physical properties?
Answers: 3
image
Engineering, 04.07.2019 19:20, sashajayne8260
Determine the stoichiometric and actual air-fuel ratios and the mole flue gas composition for combustion with 15% excess air for raw indiana, pennsylvania raw coal.
Answers: 3
image
Engineering, 06.07.2019 02:30, sandy2597
Precipitation hardening can be achieved in many light alloys by a three-step heat treatment. what is carried out and what is the purpose at each step? why is such a treatment necessary based on the nucleation and growth theory of phase transformation. compare this treatment with tempering martensite for carbon steels (similarities and differences).
Answers: 1
image
Engineering, 06.07.2019 03:20, lelen2021
Steam at a pressure of 100 kpa and a quality of 50% initially fills a rigid vessel having a volume of 0.5 m^3. the steam is then heated, causing the pressure in the vessel to rise to 150 kpa. determine: i. the mass of the steam in the vessel. ii. the temperature and quality of the steam after the heating process. ii the mass of the vapour, mg and liquid, m in the vessel after the heating process. if the steam in the vessel is now further heated, what would the pressure and temperature in the vessel be when all steam has turned into saturated vapour? b. sketch the processes in part (a) and part (b) on p-v and t-v diagrams, indicating clearly the temperatures, pressures and the paths. c. (0.59kg, 111.4°c, 73%, 0.4307kg, 0.1 593kg, 2.11 bar, 121.84°c)
Answers: 1
You know the right answer?
SOLVE IN C: Brute force equation solver

Numerous engineering and scientific applications...

Questions in other subjects:

Konu
Mathematics, 26.11.2019 00:31
Konu
Spanish, 26.11.2019 00:31
Konu
Physics, 26.11.2019 00:31