码迷,mamicode.com
首页 > 其他好文 > 详细

99乘法表

时间:2016-05-08 06:36:19      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:

用while循环实现
public static void main(String args[]){
     int a=1 ,b=1;
     while(a<10){
      while(b<10){System.out.print(a+"*"+b+"="+a*b+‘\t‘);b++;}
       ++a;b=a;System.out.println();
   }
  }
用三元运算实现
public static void main(String args[]){
int a=1,b=1;
while( ((a<10)&&(b<10)) ?true:false)
{
System.out.print(a+"*"+b+"="+a*b++ +‘\t‘);
if(b==10){b=++a;System.out.println(‘\n‘);}}

用for循环实现

public static void main(String args[]){
for(int i=1;i<10;i++){
for(int j=i;j<10;j++){
System.out.print(i+"*"+j+"="+i*j +‘\t‘);
}System.out.println();
}





 

99乘法表

标签:

原文地址:http://www.cnblogs.com/zhimazhadan/p/5469624.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!