A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© 向前爬的虫子 中级黑马   /  2016-4-24 20:16  /  747 人查看  /  8 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

99乘法表如何打印??????????

8 个回复

倒序浏览
import java.util.Scanner;
class NineNine {
        public static void main(String[] args){
                System.out.println("输入要打印的乘法表阶数:");
                Scanner sr=new Scanner(System.in);
                int a=sr.nextInt();
                for (int i=1;i<=a ;i++ ) {
                        for (int j=1;j<=i ;j++ ) {
                                System.out.print(j+"*"+i+"="+i*j+'\t');
                        }
                        System.out.println();
                }

        }
}
可以控制要打印的乘法表的阶数
回复 使用道具 举报
来学习了
回复 使用道具 举报
class JiSuan {
        public static void main(String[] args) {
                for(int x=1;x<=9;x++) {
                        for(int y=1;y<=x;y++){
                                System.out.print(y+"*"+x+"="+y*x+"\t");       
                        }
                        System.out.println();
                }
               
        }
}
回复 使用道具 举报
你可以去我的共享看看,上面解释的很详细
回复 使用道具 举报
嵌套循环
回复 使用道具 举报
最远 中级黑马 2016-4-24 22:15:20
7#
好多方法  自己研究一下
回复 使用道具 举报
class print99
{
public static void main(String[]args)
{
  print99();
   
     
  System.out.println("hello");
  
}
public static void print99()
{
  for(int x=1;x<=9;x++)
  {
   for(int y=1;y<=x;y++)
   {
    System.out.print(y+"*"+x+"="+y*x+"\t");
   }
  System.out.println();
  }
}
}

回复 使用道具 举报

public class jiu {

        /**
         * @param args
         */
        public static void main(String[] args) {
                for ( int i = 1 ; i <= 9 ; i ++ ){
                       
                        for ( int y = 1 ; y<= i;y++ ){
                               
                                System.out.print (i + "*" + y + "=" + (i*y));
                               
                        }
                       
                        System.out.println ();
                }
       
        }

}
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马