Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Vampire {
- public static int a (int n) {
- return n/1000;
- }
- public static int b (int n) {
- return (n / 100) - 10;
- }
- public static int c (int n) {
- return(n / 10) % 10;
- }
- public static int d(int n) {
- return n%10;
- }
- public static int number(int i , int k) {
- return (i*10) + k;
- }
- public static void test (int i , int j ,int k) {
- if( i == (j * k))
- System.out.println(i);
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- for (int i =1000 ; i<= 9999 ; i++) {
- test(i, number(a(i), b(i)), number(c(i), d(i)));
- test(i, number(a(i), b(i)), number(d(i), c(i)));
- test(i, number(a(i), c(i)), number(b(i), d(i)));
- test(i, number(a(i), c(i)), number(d(i), b(i)));
- test(i, number(a(i), d(i)), number(b(i), c(i)));
- test(i, number(a(i), d(i)), number(c(i), b(i)));
- test(i, number(b(i), a(i)), number(c(i), d(i)));
- test(i, number(b(i), a(i)), number(d(i), c(i)));
- test(i, number(b(i), c(i)), number(d(i), a(i)));
- test(i, number(b(i), d(i)), number(c(i), a(i)));
- test(i, number(c(i), a(i)), number(d(i), b(i)));
- test(i, number(c(i), b(i)), number(d(i), a(i)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement