流浪少年  
个人网站 http://112.25.151.114:8098/MyWeb/main

public class recursionTest {
public static void main(String[] args) {
//jiujiu();
m(9);
}
/*
* for循环99乘法表
* */
public static void jiujiu(){
for (int i = 1; i < 10; i++) {
for (int j = 1; j <= i; j++) {
System.out.println(j + "*" + i + "=" + j * i+" ");
}
System.out.println(" ");
}
}
/*
* 递归99乘法表
*
* */
public static void m(int i){
if(i==1){
System.out.println("1*1=1");
}else{
m(i-1);
for(int j=1;j<=i;j++){
System.out.println(j + "*" + i + "=" + j * i+" ");
}
System.out.println(" ");
}
}
}

posted on 2017-12-05 13:14  流浪少年  阅读(4103)  评论(0编辑  收藏  举报