99乘法表for循环、while循环
class Print99{
public static void main(String[] args){
for (int i = 1 ; i <= 9; i++) {
for (int j = 1 ; j <= i ; j++) {
System.out.print(j+"*" + i +"=" + i*j +"\t");
}
System.out.println();
}
}
}
/*
99乘法表
*/
class While99{
public static void main(String[] args){
int i=1;
while(i<10){
int j=1;
while(j<10){
System.out.print(i+"x"+j+"="+i*j+"\t");
j++;
}
System.out.println();
i++;
}
}
}
/*
99乘法表
左斜
*/
class While99Zuo{
public static void main(String[] args){
int i=1;
while(i<10){
int j=1;
while(j<=i){
System.out.print(i+"x"+j+"="+i*j+"\t");
j++;
}
System.out.println();
i++;
}
}
}
本文出自 “点点滴滴” 博客,请务必保留此出处http://10718270.blog.51cto.com/10708270/1769541