/* 递归连续数
以下程序打印出0~9的数字,请补充缺少的代码。
*/
public class 递归连续数 {
public static void f(int begin, int end) {
if(begin>end) return; // 填空
System.out.println(begin);
f(begin + 1, end);
}
public static void main(String[] args) {
f(0, 9);
}
}
运行结果:
0
1
2
3
4
5
6
7
8
9