返回列表 發帖

九九乘法表 (一)

利用巢狀迴圈,寫一個排列整齊的九九乘法表如下圖所示。
提示:\t 代表鍵盤上的Tab鍵,可用來對齊。

  1. public class Ch14 {

  2.         public static void main(String[] args) {
  3.                 for(int i=1; i<=9; i++)
  4.                 {
  5.                         for(int j=1; j<=9; j++)
  6.                         {
  7.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");
  8.                         }
  9.                         System.out.println();
  10.                 }
  11.         }
  12. }
複製代碼

  1. public class Ch01 {
  2.     public static void main(String[]args){
  3.                 for(int i=1;i<=9;i++)
  4.                 {
  5.                         for(int j=1;j<=9;j++)
  6.                         {
  7.                             System.out.print(i+"x"+j+"="+(i*j)+"\t");
  8.                         }
  9.                     System.out.println();   
  10.                 }
  11.         }
  12. }
複製代碼

TOP

  1. public class ch02 {
  2.         public static void main(String args[]){
  3.                 for(int i=1;i<=9;i++)
  4.                 {
  5.                         for(int j=1;j<=9;j++)
  6.                         {
  7.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");       
  8.                         }
  9.                         System.out.println();
  10.                 }
  11.         }

  12. }
複製代碼
我好帥
我超級帥
我非常的帥
我宇宙第一帥

TOP

  1. package ch01;

  2. public class ch02
  3. {
  4.         public static void main(String[] args)
  5.         {
  6.                 for(int i=1;i<=9;i++)
  7.             {
  8.                         for(int j=1;j<=9;j++)
  9.                         {
  10.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");
  11.                         }
  12.                         System.out.println();
  13.             }
  14.         }
  15. }
複製代碼

TOP

  1. public class Ch01 {


  2.         public static void main(String[] args) {
  3.                 for(int i=1 ; i<=9 ; i=i+1)
  4.                 {
  5.                     for(int j=1; j<=9; j=j+1)
  6.                     {
  7.                            
  8.                             System.out.print(i+"x"+j+"="+(1*j)+"\t");
  9.                     }
  10.                     System.out.println();
  11.                     }
  12.                
  13.                 }
  14.                
  15.         }       
複製代碼

TOP

  1. public class Ch01 {

  2.         public static void main(String[] args) {
  3.                
  4.                 for(int i=1;i<=9;i++)
  5.                 {
  6.                         for(int j=1;j<=9;j++)
  7.                         {
  8.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");
  9.                         }
  10.                         System.out.println();
  11.                 }
  12.                
  13.         }

  14. }
複製代碼

TOP

  1. public class Ch01 {
  2.         public static void main(String[] args) {
  3.                
  4.                 for(int i=1; i<=9;i++)
  5.                 {
  6.                      for(int j=1; j<=9; j++)
  7.                      {
  8.                       System.out.print(i+"X"+j+"="+(i*j)+"\t");
  9.                      }
  10.         System.out.println();
  11.                 }       
  12. }       
  13. }       
複製代碼

TOP

  1. public class Ch01
  2. {
  3.    
  4.     public static void main(String[] args)
  5.     {
  6.         for(int i=1;i<=9;i++)
  7.         {
  8.             for(int j=1;j<=9;j++)
  9.             {
  10.                     System.out.print(i+"x"+j+"="+(i*j)+"\t");
  11.             }
  12.                     System.out.println();
  13.         }       
  14.         }

  15. }
  16. public class Ch01
  17. {
  18.    
  19.     public static void main(String[] args)
  20.     {
  21.         for(int i=1;i<=9;i++)
  22.         {
  23.             for(int j=1;j<=9;j++)
  24.             {
  25.                     System.out.print(i+"x"+j+"="+(i*j)+"\t");
  26.             }
  27.                     System.out.println();
  28.         }       
  29.         }

  30. }
複製代碼

TOP

  1. public class Ch16 {
  2. public static void main(String args[]){
  3. for(int i=1; i<=9; i++)
  4. {
  5.         for(int j=1; j<=9; j++)
  6.         {
  7.                 System.out.print(i+"x"+j+"="+(i*j)+"\t");
  8.         }
  9.         System.out.println();
  10. }
  11.                
  12. }
  13. }
複製代碼

TOP

  1. public class Ch41 {

  2.         public static void main(String[] args) {
  3.                 for(int a=1; a<=9; a=a+1)
  4.                 {
  5.                         for(int b=1; b<=9; b=b+1)
  6.                         {
  7.                                 System.out.print(a+"x"+b+"="+(a*b)+" "+"\t");
  8.                         }
  9.                         System.out.println();
  10.                 }

  11.         }

  12. }
複製代碼

TOP

  1. public class Ch13 {

  2.         public static void main(String[] args) {
  3.                 for(int i=1; i<=9; i++)
  4.                 {
  5.                         for(int j=1; j<=9; j++)
  6.                         {
  7.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");
  8.                         }
  9.                         System.out.println();
  10.                 }
  11.                
  12.         }

  13. }
複製代碼

TOP

  1. import java.util.Scanner;
  2. public class Ch01 {

  3.         public static void main(String[] args) {
  4.                

  5.                 for(int i=1;i<=9; i++)
  6.                 {
  7.                   for(int j=1;j<=9;j++)       
  8.    
  9.             
  10.                  {       
  11.                    System.out.print(i+"x"+j+"="+(i*j)+"\t");  
  12.              }
  13.                  System.out.println();
  14.          }
  15.         }
  16. }
複製代碼

TOP

  1. public class Ch99 {
  2.         public static void main(String[] args) {       
  3.                 for(int i=1;i<=9 ;i+=1)  
  4.                 {
  5.                         for(int j=1; j<=9; j+=1 )                                       
  6.                         {
  7.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t" );
  8.                         }
  9.              System.out.println();
  10.                 }                            
  11.         }
  12. }
複製代碼

TOP

  1. public class Ch16 {
  2.     public static void main(String args[])
  3.     {
  4.            
  5.     for(int i=1;i<=9;i++)
  6.         {
  7.                 for(int j=1;j<=9;j++)
  8.                 {
  9.                         System.out.print(i+"x"+j+"="+(i*j)+"\t");
  10.                 }
  11.            
  12.                 System.out.println();
  13.         }
  14.     }
  15. }
複製代碼

TOP

  1. public class Ch23 {

  2.         public static void main(String[] args) {
  3.         for(int i=1; i<=9; i++)
  4.         {
  5.                 for(int j=1; j<=9; j++)
  6.                 {
  7.                         System.out.print(i+"x"+j+"="+(i*j)+"\t");
  8.                 }       
  9.                 System.out.println();
  10.         }       

  11.         }

  12. }
複製代碼

TOP

  1. public class Ch10 {

  2.         public static void main(String[] args) {
  3.                
  4.                 for(int i=1;i<=9;i++){
  5.                         for(int j=1;j<=9;j++){
  6.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");
  7.                         }
  8.                             System.out.println();
  9.                      }
  10.                     
  11.                 }
  12.         }
  13.                
  14.                
複製代碼

TOP

  1. public class Ch04 {

  2.         public static void main(String[] args) {
  3.                 for(int i=1; i<=9; i++)
  4.                 {
  5.                         for(int j=1; j<=9; j++)
  6.                         {
  7.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");
  8.                                
  9.                                
  10.                                
  11.                         }
  12.                         System.out.println();
  13.                        
  14.                 }

  15.         }

  16. }
複製代碼

TOP

  1. public class Ch14 {

  2.         public static void main(String[] args) {
  3.                 for(int i=1;i<=9;i++)
  4.                 {
  5.                         for(int j=1;j<=9;j++)
  6.                         {
  7.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");                                                               
  8.                         }
  9.                         System.out.println();
  10.                 }                                                   
  11.         }
  12. }
複製代碼

TOP

  1. package fine;

  2. public class foradd {

  3.         public static void main(String[] args) {
  4.                 for(int i=1;i<=9;i++)
  5.                 {
  6.                         for (int j=1;j<=9;j++)
  7.                         {
  8.                                 System.out.print(i+"x"+j+"="+(i*j)+"\t");
  9.                         }
  10.                         System.out.println();       
  11.                 }
  12.                

  13.         }

  14. }
複製代碼

TOP

  1. import java.util.Scanner;
  2. public class Ch03
  3. {
  4.         public static void main(String args[]){
  5.         for (int i=1; i<=9; i++)
  6.         {
  7.                 for(int j=1; j<=9; j++)
  8.                 {
  9.                         System.out.print(i+"x"+j+"="+(i*j)+"\t");
  10.                 }
  11.                 System.out.println();
  12.            }
  13.         }
  14. }
複製代碼

TOP

返回列表