java 九九乘法表从右边输出的

1x1
2x2 2x1
3x3 3x2 3x1
4x4 4x3 4x2 4x1
5x5 5x4 5x3 5x2 5x1
6x6 6x5 6x4 6x3 6x2 6x1
7x7 7x6 7x5 7x4 7x3 7x2 7x1
8x8 8x7 8x6 8x5 8x4 8x3 8x2 8x1
9x9 9x8 9x7 9x6 9x5 9x4 9x3 9x2 9x1

这种形式的,只用for 或 if,等简单语句
最好有注释,万分感谢!!!

第1个回答  2012-03-27
public class Demo4 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
for (int i = 1; i <= 9; i++) {
for (int j = i; j >= 1; j--) {
if (j == i) {
for (int k = 9 - j; k > 0; k--) {
System.out.print(" ");
}
}
System.out.print(i + "*" + j + " ");
}
System.out.println();
}
}
}本回答被提问者采纳
相似回答