日期:2014-05-19 浏览次数:20641 次
public class TestDemo{ public static void main(String[] args) { int count1=1; int count =6; for(int j=0;j<6;j++){ print(count1); System.out.print(print(count1)+" "+print(count)+" "+printX(count1)+" "+print(count)); System.out.println(); count1++; count--; } } static String print(int n){ if(n<=1){ return "1"; } else return print(n-1)+n; } static String printX(int n){ if(n<=1){ return "1"; } else return n+print(n-1); } }