Question

6.11 LAB: Brute force equation solver Numerous engineering and scientific applications require finding solutions to a set of
6.11 LAB: Brute force equation solver Numerous engineering and scientific applications require finding solutions to a set of Java


0 0
Add a comment Improve this question Transcribed image text
Answer #1

*****************************************************************************
PLEASE DO UPVOTE IF THE ANSWER IS HELPFUL AS IT GIVES THE CONFIDENCE TO HELP MORE STUDENTS
*****************************************************************************
In case If I have not answered completely, it's because Chegg allows me to answer a specific no of questions including the subparts, so please do post the rest of the questions as a separate query as per Chegg Guidelines. Thank you :)
*****************************************************************************

import java.util.*;

class Hello {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int a, b, c, x, y, z;

        int p, q;

        a = sc.nextInt();

        b = sc.nextInt();

        c = sc.nextInt();

        x = sc.nextInt();

        y = sc.nextInt();

        z = sc.nextInt();

        int flag = 0;

        for (int i = -10; i <= 10; i++) {

            for (int j = -10; j <= 10; j++) {

                if ((a * i + b * j == c) && (x * i + y * j == z)) {

                    System.out.println(i + " " + j);

                    flag = 1;

                }

                if (flag == 1)

                    break;

            }

            if (flag == 1)

                break;

        }

        if (flag == 0) {

            System.out.println("No solution");

        }

878 3-5 -1 32   }}

Add a comment
Know the answer?
Add Answer to:
Java 6.11 LAB: Brute force equation solver Numerous engineering and scientific applications require finding solutions to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT