public class 乘法表 { public static void main(String[] args) { for (int i = 1; i <10 ; i++) { for (int j = 1; j <=i ; j++) { System.out.print(j+"*"+i+"="+i*j+" "); } System.out.println(); } System.out.println("------------------------------------------------------------------------");/*分割线*/ for (int q =9;q>=1;q--){ for (int w=1;w<=q;w++){ System.out.print(w+"*"+q+"="+w*q+" "); } System.out.println(); } } }
print和println区别一定要分清楚!!!