public static void main(String[] args) { int t = 20; int c=20; while (t > 0) { //t /= (3+1) ; t /=3+1; System.out.print("tttttttttt" + t); } System.out.println(); while (c > 1) { c=c/3+1; System.out.print("ccccccccccc"+c); } }
运行结果:
t= 5 t= 1 t= 0
c= 7 c= 3 c= 2 c= 1
t/=3+1 和 t/=4 的结果是一样的。
而 t=t/3+1;是和前两的运算结果不一样。