public class For {
public static void main(String[] args){
for(int i=2; i<=1024; i *= 2){
System.out.println("Count is: " + i);
}
}
public class While {
public static void main(String[] args){
int i = 1;
while (i < 1024) {
i *= 2;
System.out.println("Count is: " + i);
}
}
public class DoWhile {
public static void main(String[] args){
int i = 1;
if (i < 1024) {
do { i*=2;
System.out.println("Count is: " + i);
} while (i < 1024);
}
}
如何将一个转换for循环/ while循环,所以它做同样的事情,但使用递归函数?Java For循环递归函数
请把它标记为功课,以及如果它是一个 – fmucar 2011-05-04 10:52:13
如果这是家庭作业,请通过将表明这一点家庭作业标签。 – Ingo 2011-05-04 10:52:45