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 13:30
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Why is an outfitting a workspace with video games in a technology development company considered a strategic use of money
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
question
Computers and Technology, 24.06.2019 12:40
Match the feature to the network architecture. expensive to set up useful for a small organization easy to track files has a central server inexpensive to set up difficult to track files useful for a large organization does not have a central server client- server network peer-to-peer network
Answers: 3
You know the right answer?
Can you help me solve the following for C programming?

LAB: Brute force equation solver<...
Questions
question
Mathematics, 20.09.2020 17:01
question
Mathematics, 20.09.2020 17:01
question
Mathematics, 20.09.2020 17:01
question
History, 20.09.2020 17:01
question
Mathematics, 20.09.2020 17:01
question
Social Studies, 20.09.2020 17:01
Questions on the website: 13722363