subject

Can you help me solve the following for C programming?

LAB: 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.

I'm having trouble finding a brute force solution. This is what I have so far. Thanks!

#include

int main(void) {
//variables with input will be coefficients of x and y for equation 1, and the solution for equation 1,
// and coefficients of x and y for equation 2, and the solution for equation 2
//variables that depend on input will be x and y in the range of -10 to 10

int coeffX1;
int coeffY1;
int solut1;
int coeffX2;
int coeffY2;
int solut2;
int X;
int Y;

//code should Check if the current x and y satisfy both equations. If so, output the solution, and finish.
//For every value of x from -10 to 10 && For every value of y from -10 to 10
scanf("%d %d %d %d %d %d",&coeffX1,&coeffY1,& solut1,&coeffX2,&coeffY2,&a mp;solut2);
X=-10;
Y=-10;
while(X>=-10 && X<=10){
if(!=X, X=solut2){
X=X+1;
}
while( Y>=-10 && Y<=10){
if((X*coeffX1)+(Y*coeffY1)!=solut1 &&(X*coeffX2)+(Y*coeffY2)!= solut2){

Y=Y+1;
}
if((X*coeffX1)+(Y*coeffY1)==solut1 &&(X*coeffX2)+(Y*coeffY2)== solut2)
{
printf("%d %d",X, Y);
}
}

}

//printf("%d %d %d \n%d %d %d",coeffX1,coeffY1,solut1,coeffX2, coeffY2,solut2);
//X=((coeffY2*Y+solut2)/coeffX2); //solut1=coeffX1*((coeffY2*Y+solut2 )/coeffX2)+(coeffY2*Y);
//printf("%d",Y);

return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:30
Some of your friends have gotten into the burgeoning field of time-series data mining, in which one looks for patterns in sequences of events that occur over time. purchases at stock exchanges--what’s being bought-- are one source of data with a natural ordering in time. given a long sequence s of such events, your friends want an efficient way to detect certain "patterns" in them--for example, they may want to know if the four events buy yahoo, buy ebay, buy yahoo, buy oracle occur in this sequence s, in order but not necessarily consecutively. they begin with a collection of possible events (e.g., the possible’ transactions) and a sequence s of n of these events. a given event may occur multiple times in s (e.g., yahoo stock may be bought many times in a single sequence s). we will say that a sequence s’ is a subsequence of s if there is a way to delete certain of the events from s so that the remaining events, in order, are equal to the sequence s’. so, for example, the sequence of four events above is a subsequence of the sequence buy amazon, buy yahoo, buy ebay, buy yahoo, buy yahoo, buy oracle their goal is to be able to dream up short sequences and quickly detect whether they are subsequences of s. so this is the problem they pose to you: give an algorithm that takes two sequences of even~s--s’ of length m and s of length n, each possibly containing an event more than once--and decides in time o(m n) whether s’ is a subsequence of s
Answers: 2
question
Computers and Technology, 22.06.2019 07:30
By refraining from constructing a building until they are certain that it will not cause harm to the environment, an organization is adhering to the
Answers: 2
question
Computers and Technology, 22.06.2019 11:30
What do character formats do for your document's message? a.set the tone b.provide organization c.provide clarity d.set how texts align with documents
Answers: 2
question
Computers and Technology, 22.06.2019 16:30
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 2
You know the right answer?
Can you help me solve the following for C programming?

LAB: Brute force equation solver<...
Questions
question
Mathematics, 27.06.2019 13:00
question
Mathematics, 27.06.2019 13:00
question
Mathematics, 27.06.2019 13:00
question
Health, 27.06.2019 13:00
Questions on the website: 13722363