- /**
- * 利用 for 循环打印 9*9 表
- * @author Administrator
- *
- */
- public class qiuhe {
- public static void main(String[] args) {
-
- chengfabiao1();
- chengfabiao2();
- }
-
-
-
- static void chengfabiao2(){
- for(int i = 1 ; i<=9 ; i++){
- for(int k= 1;k<=9-i+1;k++){
- // if(k<i)
- // continue;
- System.out.print(" "+k+"*"+i+"="+i*k);
- }
- System.out.println();
- }
- }
-
- static void chengfabiao1(){
- for(int i = 1 ; i<=9 ; i++){
- for(int k = 1;k<=9;k++){
- if(k>i)
- continue;
- System.out.print(" "+k+"*"+i+"="+i*k);
- }
- System.out.println();
- }
- }
- }
复制代码
|
|