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 16:30
Corey set up his presentation for delivery to his team.the information he had to convey was critical to their job performance.he knew he would need a lot of time to explain each point
Answers: 3
question
Computers and Technology, 22.06.2019 22:10
Asequential circuit contains a register of four flip-flops. initially a binary number n (0000 ≤ n ≤ 1100) is stored in the flip-flops. after a single clock pulse is applied to the circuit, the register should contain n + 0011. in other words, the function of the sequential circuit is to add 3 to the contents of a 4-bit register. design and implement this circuit using j-k flip-flops.
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
Jaina and tomas are being considered as new tenants in an apartment. the landlord looks at their creditworthiness because he wants to be sure his new tenant pays the rent on time and in full. the table below summarizes the information that was on their applications. application information questions jaina tomas how many years have you had your job? 5 2 what is your monthly salary? $1,850 $2,500 how many credit cards do you have? 4 1 how much debt do you have? $13,000 $7,000 how many times were you late with payments on credit cards in the past year? 5 1 who will the landlord decide to be more creditworthy and why? tomas because the ratio of his debt to income is less. jaina because she has had her job longer, which makes her look more stable. jaina because she has more credit cards available to her. tomas because he makes more money per month.
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
You know the right answer?
Can you help me solve the following for C programming?

LAB: Brute force equation solver<...
Questions
Questions on the website: 13722363