标签:style log blog [] color 依次 demo ati nbsp
要求:
输入:begin和end
输出:依次打印出begin到end
1 import java.util.Scanner; 2 //递归打印begin —— end 3 public class demo1 { 4 5 public static void f(int begin,int end){ 6 if(end-1>=begin){ 7 f(begin,end-1); 8 } 9 System.out.print (end+" "); 10 } 11 public static void main(String[] args) { 12 Scanner sc = new Scanner(System.in); 13 int begin = sc.nextInt(); 14 int end = sc.nextInt(); 15 f(begin,end); 16 } 17 18 }
标签:style log blog [] color 依次 demo ati nbsp
原文地址:http://www.cnblogs.com/yg1024/p/7726307.html