import java.util.Scanner; public class MainClass { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int x = 1; int y = 1; int ans = 0; while (x <10 ) { while(y<10){ ans = x * y; System.out.print(y + "*" + x + "=" + ans + "\t"); y++; } x++; y = 1; System.out.println(); } } }
09.10更新 for寫法
public class MainClass { public static void main(String[] args) { java.util.Scanner scanner = new java.util.Scanner(System.in); int x = 0; int y = 0; for(x = 1; x<10; x++) { for(y = 1; y<10; y++) { System.out.print(x + "*" + y + "=" + x*y + "\t"); } System.out.println(); } } }
全站熱搜
留言列表