标签:style == ++ img ati src system pre 常见
判断一个整数能被几个9整除。
public static void main(String[] args) {
f(729); f(730); } public static void f(int n) { int tmp = n; int count = 0; for (int i = 0; tmp % 9 == 0;) { tmp = tmp / 9; count++; } System.out.println(n + "能够被 " + count + "个9整除。"); }
标签:style == ++ img ati src system pre 常见
原文地址:http://www.cnblogs.com/mr-wuxiansheng/p/7545711.html