【Java】Java_15 打印九九乘法表
使用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 打印九九乘法表的更多相关文章
- 用java代码打印九九乘法表
package com.wf; public class cal { public static void main(String[] args) { for(int i=1;i<10;i++) ...
- scala打印九九乘法表的5种实现
使用scala打印九九乘法表,可以有多种实现方法,实现的过程充分的体现的scala语言的优势和巨大的简洁性和高效性, 下面我用了5种方法实现九九乘法表. 使用类似于java,c++等指令风格的的编程实 ...
- Java Web之九九乘法表
NineTabs.jsp 1 <%@ page language="java" import="java.util.*" contentType=&quo ...
- 自编Basic脚本 用BasicIntepreter执行 打印九九乘法表
源码下载:https://files.cnblogs.com/files/heyang78/BasicInterpreter2-20200601-2.rar 用编程语言打印九九乘法表不难,用自编解释器 ...
- Java-for循环打印九九乘法表
Java打印九九乘法表 public class forDemo04 { public static void main(String[] args) { //练习3:打印九九乘法表 /* 1*1=1 ...
- for循环打印九九乘法表
学习目标: 熟练掌握 for 循环的使用 例题: 需求:打印九九乘法表 代码如下: // 九九乘法表 // row 为行,col为列 for(int row = 1; row < 10; row ...
- C#打印九九乘法表
C#打印九九乘法表... ---------------------------------- using System; using System.Collections.Generic; usin ...
- 利用Python循环(包括while&for)各种打印九九乘法表
一.for循环打印九九乘法表 #注意:由于缩进在浏览器不好控制,请大家见谅,后续会有图片传入. 1.1 左下角 for i in range(1,10): for j in range(1,i+1): ...
- 写一个方法,用一个for循环打印九九乘法表
public class MultiplicationTable { /** * @description 写一个方法,用一个for循环打印九九乘法表 * @author wangkun * ...
随机推荐
- Spark GraphX宝刀出鞘,图文并茂研习图计算秘笈与熟练的掌握Scala语言【大数据Spark实战高手之路】
Spark GraphX宝刀出鞘,图文并茂研习图计算秘笈 大数据的概念与应用,正随着智能手机.平板电脑的快速流行而日渐普及,大数据中图的并行化处理一直是一个非常热门的话题.图计算正在被广泛地应用于社交 ...
- 计蒜客 1460.Ryuji doesn't want to study-树状数组 or 线段树 (ACM-ICPC 2018 徐州赛区网络预赛 H)
H.Ryuji doesn't want to study 27.34% 1000ms 262144K Ryuji is not a good student, and he doesn't wa ...
- CF 1003C Intense Heat【前缀和/精度/双层暴力枚举】
The heat during the last few days has been really intense. Scientists from all over the Berland stud ...
- Android学习--广播机制
广播机制简介 Android的广播可以分为两种类型的,标准广播和有序的广播: 标准广播: 是一种完全异步执行的广播,在广播发出去之后,所有的广播接收器几乎是同一时接收到这条广播. 有序广播: 是一 ...
- Codeforces Round #406 (Div. 2) D. Legacy (线段树建图dij)
D. Legacy time limit per test 2 seconds memory limit per test 256 megabytes input standard input out ...
- linux基本优化
修改主机名 hostnamectl set-hostname <hostname> 修改终端命令行颜色 # vim /etc/profile 末尾添加 PS1='\[\e[31;40m\] ...
- BZOJ 3524 [Poi2014]Couriers(可持久化线段树)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3524 [题目大意] 给一个长度为n的序列a.1≤a[i]≤n. m组询问,每次询问一个 ...
- python3 中 and 和 or 运算规律
一.包含一个逻辑运算符 首先从基本的概念着手,python中哪些对象会被当成 False 呢?而哪些又是 True 呢? 在Python中,None.任何数值类型中的0.空字符串“”.空元组().空列 ...
- xib中Autolayout的使用
压缩包下载链接:http://share.weiyun.com/ceb6107857789ae3ec08d4a83269713d (密码:Kd33)
- Linux下的/etc/crontab文件和crontab -e命令区别及Crontab命令详解(转)
/etc/crontab文件和crontab -e命令区别 1.格式不同 前者 # For details see crontabs # Example of job definition: # .- ...