星空网 > 软件开发 > Java

【Java_Base】九九乘法表

 

 案例一

1 class Multiplication{ 2 public static void main(String args[]){ 3 String Str = "9 9 乘法表\n"; 4 Str += "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; 5 System.out.println(Str); 6 for(int i=1;i<10;i++){ 7 for(int j=1;j<=i;j++){ 8 //打印乘法表 9 System.out.print(j+"×"+i+"="+i*j);10 //添加逗号11 if(i!=j){12 System.out.print(",");13 }14 }15 //每打印一行输出一个换行符16 System.out.print("\n");17 }18 }19 }

【Java_Base】九九乘法表

案例二

 1 public class Multiplication_Table { 2  3   public static void main(String[] args) { 4  5     String Str = "9 9 乘法表\n"; 6     Str += "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; 7     for (int i = 1, j = 1; i < 10; j++) { 8       Str += "\t"+ j + "*" + i + "=" + j * i; 9       if (i == j) {10         j = 0;11         i++;12         Str += "\n";13       }14     }15     System.out.println(Str);16   }17 }

 

【Java_Base】九九乘法表



 




原标题:【Java_Base】九九乘法表

关键词:JAVA

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

Shopee客户给差评怎么挽救?:https://www.goluckyvip.com/news/7340.html
深圳口岸数字清关加速:618期间单日破5万单:https://www.goluckyvip.com/news/7341.html
解读▏跨境电商9610出口报关及退税流程:https://www.goluckyvip.com/news/7342.html
巧用Shopee基本营销工具,提升店铺销量:https://www.goluckyvip.com/news/7343.html
亚马逊印度物流投资37.5亿卢比,大包装购物呈热趋:https://www.goluckyvip.com/news/7344.html
Lazada什么产品好卖?Lazada新手卖家选品推荐 :https://www.goluckyvip.com/news/7345.html
中国有哪些著名的酒店品牌。:https://www.vstour.cn/a/411242.html
石象湖景区门票-石象湖景区门票优惠政策:https://www.vstour.cn/a/411243.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流