返回列表 發帖

九九乘法表 (一)

本帖最後由 tonyh 於 2021-8-17 18:24 編輯

  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.                                 System.out.print(i+"x"+j+"="+i*j+"\t");
  7.                         System.out.println();
  8.                 }
  9.         }
  10. }
複製代碼
  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.                                 System.out.printf("%dx%d=%-2d  ",i, j, i*j);
  7.                         System.out.println();
  8.                 }
  9.         }
  10. }
複製代碼

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

TOP

  1. public class Ch08
  2. {
  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.                  System.out.printf("%dx%d=%-2d ",i,j,i*j);
  9.              System.out.println();
  10.          }
  11.     }
  12. }
複製代碼

TOP

返回列表