Answer to Question #302506 in Java | JSP | JSF for mogs

Question #302506

Faizan and Hamza are brothers. In three years, Hamza will be five years younger than two time’s Faizan’s current age. Write a Java program to calculate and display Hamza’s age


1
Expert's answer
2022-02-25T10:29:26-0500
public class Main {
    public static void main(String[] args) {
        for (int x = 0; x < 200; x++) {
            for (int y = 0; y < 200; y++) {
                if (x + 3 == 2 * y - 5) {
                    System.out.println(x);
                    System.exit(0);
                }
            }
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS