Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- *
- * @author JARVIS-MAIN
- */
- public class AbcIsWhat {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner scan = new Scanner (System.in);
- double a = 0, b = 0, c = 0, count = 1;
- System.out.println("Do you to stop the program if you reach an ");
- System.out.println("answere to the ABC problem? (enter yes or no)");
- String ans = scan.nextLine();
- for (int a1 = 1; a1 <= 9; a1++) {
- a = (double) a1;
- for (int b1 = 1; b1 <= 9; b1++) {
- b = (double) b1;
- for (int c1 = 1; c1 <= 9; c1++) {
- c = (double) c1;
- System.out.println("======[" + count + "]=====");
- System.out.println("a: " + a);
- System.out.println("b: " + b);
- System.out.println("c: " + c);
- double part1 = joinNumber(a,b,c) / 5;
- double part2 = (a * b * c);
- System.out.println("part 1: " + part1);
- System.out.println("part 2: " + part2);
- if (part1 == part2) {
- System.out.println("======[EQUAL]=====");
- System.out.println("part 1: " + part1);
- System.out.println("part 2: " + part2);
- if(ans.equalsIgnoreCase("yes")){
- System.exit(0);
- }
- }
- count++;
- }
- }
- }
- }
- public static double joinNumber(double a, double b, double c) {
- double send = (100 * a) + (10 * b) + (1 * c);
- return send;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement