乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      java編程題:以三種不同方式輸出九九乘法表(java)

       昵稱27831725 2018-03-11

      第一種方式:方形

      打印結(jié)果:

      1*1=1 2*1=2  3*1=3  4*1=4  5*1=5  6*1=6  7*1=7  8*1=8  9*1=9
      1*2=2 2*2=4 3*2=6 4*2=8 5*2=10 6*2=12 7*2=14 8*2=16 9*2=18
      1*3=3 2*3=6 3*3=9 4*3=12 5*3=15 6*3=18 7*3=21 8*3=24 9*3=27
      1*4=4 2*4=8 3*4=12 4*4=16 5*4=20 6*4=24 7*4=28 8*4=32 9*4=36
      1*5=5 2*5=10 3*5=15 4*5=20 5*5=25 6*5=30 7*5=35 8*5=40 9*5=45
      1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36 7*6=42 8*6=48 9*6=54
      1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49 8*7=56 9*7=63
      1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64 9*8=72
      1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81

      代碼如下:

      1. /** 
      2.  * java 打印出九九乘法表 
      3.  */  
      4. public class Test_9x9 {  
      5.   
      6.     public static void main(String[] args) {  
      7.         //方形  
      8.         for (int i = 1; i <=9; i++) {  
      9.             for (int j = 1; j <=9; j++) {  
      10.                 System.out.print(j+"*"+i+"="+(i*j)+"\t");  
      11.             }  
      12.             System.out.println();  
      13.         }  
      14.     }  
      15.       
      16. }  


      第二種方式:正三角

      打印結(jié)果:

      1*1=1
      1*2=2 2*2=4
      1*3=3 2*3=6 3*3=9
      1*4=4 2*4=8 3*4=12 4*4=16
      1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
      1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
      1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
      1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
      1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81

      代碼如下:

      1. /** 
      2.  * java 打印出九九乘法表 
      3.  */  
      4. public class Test_9x9 {  
      5.   
      6.     public static void main(String[] args) {  
      7.         //倒三角  
      8.         for (int i = 1; i <=9; i++) {  
      9.             for (int j = 1; j <=i; j++) {  
      10.                 System.out.print(j+"*"+i+"="+(i*j)+"\t");  
      11.             }  
      12.             System.out.println();  
      13.         }  
      14.           
      15.     }    
      1. <span style="font-family:Verdana, Arial, Helvetica, sans-serif;">}</span>  



      第三種方式:倒三角

      打印結(jié)果:

      1*1=1  2*1=2  3*1=3  4*1=4  5*1=5  6*1=6  7*1=7  8*1=8  9*1=9
      2*2=4 3*2=6 4*2=8 5*2=10 6*2=12 7*2=14 8*2=16 9*2=18
      3*3=9 4*3=12 5*3=15 6*3=18 7*3=21 8*3=24 9*3=27
      4*4=16 5*4=20 6*4=24 7*4=28 8*4=32 9*4=36
      5*5=25 6*5=30 7*5=35 8*5=40 9*5=45
      6*6=36 7*6=42 8*6=48 9*6=54
      7*7=49 8*7=56 9*7=63
      8*8=64 9*8=72
      9*9=81

       

      代碼如下:

      1. /** 
      2.  * java 打印出九九乘法表 
      3.  */  
      4. public class Test_9x9 {  
      5.   
      6.     public static void main(String[] args) {  
      7.         //倒三角  
      8.         for (int i=1; i<=9; i++) {  
      9.             for (int j=i; j<=9; j++) {  
      10.                 System.out.print(j+"*"+i+"="+(i*j)+"\t");  
      11.             }  
      12.             System.out.println();  
      13.         }  
      14.     }  
      15.       
      16. }  



      第四種方式:倒三角

      打印結(jié)果:

      1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81 
      1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64 
      1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49 
      1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36 
      1*5=5 2*5=10 3*5=15 4*5=20 5*5=25 
      1*4=4 2*4=8  3*4=12 4*4=16 
      1*3=3 2*3=6  3*3=9 
      1*2=2 2*2=4 
      1*1=1

      代碼如下:

      1. /** 
      2.  * java 打印出九九乘法表 
      3.  */  
      4. public class Test_9x9 {  
      5.   
      6.     public static void main(String[] args) {  
      7.         //倒三角  
      8.         for (int i=9; i>=1; i--) {  
      9.             for (int j=1; j<=i; j++) {  
      10.                 System.out.print(j+"*"+i+"="+(i*j)+"\t");  
      11.             }  
      12.             System.out.println();  
      13.         }  
      14.     }  
      15.       
      16. }  


      轉(zhuǎn)載:http://www.cnblogs.com/liuhongfeng/p/4133706.html

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多