使用For循环嵌套即可打印九九乘法表

以下是具体代码:

/**
* 打印九九乘法表
*/
package com.oliver.test; public class TestMultiplication {
public static void main(String[] args) {
for(int m=1;m<=9;m++){
for(int n=1;n<=m;n++){
System.out.print(n+"*"+m+"="+(n*m)+"\t");
}
System.out.println();//换行
}
} }

打印结果:

1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
1*4=4 2*4=8 3*4=12 4*4=16
1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81

【Java】Java_15 打印九九乘法表的更多相关文章

  1. 用java代码打印九九乘法表

    package com.wf; public class cal { public static void main(String[] args) { for(int i=1;i<10;i++) ...

  2. scala打印九九乘法表的5种实现

    使用scala打印九九乘法表,可以有多种实现方法,实现的过程充分的体现的scala语言的优势和巨大的简洁性和高效性, 下面我用了5种方法实现九九乘法表. 使用类似于java,c++等指令风格的的编程实 ...

  3. Java Web之九九乘法表

    NineTabs.jsp 1 <%@ page language="java" import="java.util.*" contentType=&quo ...

  4. 自编Basic脚本 用BasicIntepreter执行 打印九九乘法表

    源码下载:https://files.cnblogs.com/files/heyang78/BasicInterpreter2-20200601-2.rar 用编程语言打印九九乘法表不难,用自编解释器 ...

  5. Java-for循环打印九九乘法表

    Java打印九九乘法表 public class forDemo04 { public static void main(String[] args) { //练习3:打印九九乘法表 /* 1*1=1 ...

  6. for循环打印九九乘法表

    学习目标: 熟练掌握 for 循环的使用 例题: 需求:打印九九乘法表 代码如下: // 九九乘法表 // row 为行,col为列 for(int row = 1; row < 10; row ...

  7. C#打印九九乘法表

    C#打印九九乘法表... ---------------------------------- using System; using System.Collections.Generic; usin ...

  8. 利用Python循环(包括while&for)各种打印九九乘法表

    一.for循环打印九九乘法表 #注意:由于缩进在浏览器不好控制,请大家见谅,后续会有图片传入. 1.1 左下角 for i in range(1,10): for j in range(1,i+1): ...

  9. 写一个方法,用一个for循环打印九九乘法表

    public class MultiplicationTable { /**  * @description 写一个方法,用一个for循环打印九九乘法表   * @author  wangkun  * ...

随机推荐

  1. shell字符串变量的特异功能:字符串的替换(${str/源模式/目标模式},${str//源模式/目标模式})、截断

    https://blog.csdn.net/wzb56_earl/article/details/6953612

  2. HDU 2504.又见GCD-递归

    又见GCD Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submi ...

  3. UVA 11624 Fire!【两点BFS】

    Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the m ...

  4. 贮油点问题(C++)

    贮油点问题…..一道送命系列的递推… 描述 Description 一辆重型卡车欲穿过S公里的沙漠,卡车耗汽油为1升/公里,卡车总载油能力为W公升.显然卡车装一次油是过不了沙漠的.因此司机必须设法在沿 ...

  5. RPD Volume 172 Issue 1-3 December 2016 评论02

    Introduction to the special issue of Radiation Protection Dosimetry This special issue is a collecti ...

  6. Xamarin XAML语言教程控件模板的模板绑定

    Xamarin XAML语言教程控件模板的模板绑定 控件模板的模板绑定 为了可以轻松更改控件模板中控件上的属性值,可以在控件模板中实现模板绑定功能.模板绑定允许控件模板中的控件将数据绑定到公共属性上. ...

  7. [BZOJ 1926] 粟粟的书架

    BZOJ 传送门 Luogu 传送门 BZOJ的sillyB评测机各种无故CE,只好去Luogu上A了o(╯□╰)o Solution: 从数据范围可以发现,这其实是2道题: (1)一个$R*C$的矩 ...

  8. Codechef A Game With a Sheet of Paper

    Discription Yuuko and Nagi like to play the following game: Initially they take a checkered sheet of ...

  9. 【单调队列优化DP】BZOJ1855-[Scoi2010]股票交易

    [题目大意] 已知第i天的股票买入价为每股APi,第i天的股票卖出价为每股BPi(数据保证对于每个i,都有APi>=BPi),第i天的一次买入至多只能购买ASi股,一次卖出至多只能卖出BSi股. ...

  10. Java堆内存不足

    1)使用IDEA开发程序时有时候会提示“Java Heap space error”,说明IDEA默认配置的Java堆内存不足,程序需要更多的堆内存. 2)堆(Heap)和非堆(Non-heap)内存 ...