算法:求两个数的商与余数

public class dome2 {
    public static void main(String[] args) {
        test3();
    }

    // 求两个数的商和余数
    public static void test3() {
        int a = 10;
        int b = 99;
        int count = 0;
        while (b >= a) {
            b -= a;
            count++;
        }
        System.out.println("商:" + count);
        System.out.println("余数:" + b);
    }

}

你可能感兴趣的:(java,java,算法,jvm)