Java经典编程题50道之四十二

809*??=800*??+9*??+1,其中??代表的两位数,8*??的结果为两位数,9*??的结果为3位数。求??代表的两位数,以及809*??后的结果。

public class Example42 {
    public static void main(String[] args) {
        f();
    }

    public static void f() {
        int a = 809, b, i;
        for (i = 10; i < 13; i++) {
            b = i * a;
            if (8 * i < 100 && 9 * i >= 100) {
                System.out.println("\"??\"代表:"+ i);
                System.out.println("809*" + i + "=" + "800*" + i + "+" + "9*"
                        + i + "=" + b);
            }
        }
    }
}

posted @ 2017-06-09 12:34  本宫在,尔等都是妃  Views(139)  Comments(0Edit  收藏  举报