使用for循环嵌套实现乘法口诀表
来源:互联网 发布:网络英语外教一对一 编辑:程序博客网 时间:2024/05/20 05:26
九九乘法表的实现:
package com.liaojianya.chapter1;/** * This program demonstrates the way of using * for-loop to implement the multiplication tables. * @author LIAO JIANYA * 2016年7月19日 */public class ForDemo{public static void main(String[] args){for(int i = 1; i < 10; i++){for(int j = 1; j <= i; j++){System.out.print(i + "*" + j + "=" + (i * j) + "\t");}System.out.println();}}}
运行结果:
1*1=12*1=22*2=43*1=33*2=63*3=94*1=44*2=84*3=124*4=165*1=55*2=105*3=155*4=205*5=256*1=66*2=126*3=186*4=246*5=306*6=367*1=77*2=147*3=217*4=287*5=357*6=427*7=498*1=88*2=168*3=248*4=328*5=408*6=488*7=568*8=649*1=99*2=189*3=279*4=369*5=459*6=549*7=639*8=729*9=81
分析:整个程序执行1+2+3+...+9 = 45次循环
0 0
- 使用for循环嵌套实现乘法口诀表
- 用一个for循环实现打印乘法口诀表
- 使用for循环编写99乘法口诀表
- for循环——乘法口诀表
- 利用for循环输出乘法口诀表
- for循环打印乘法口诀
- 用两个for循环实现动态创建表格和实现乘法口诀表
- 乘法口诀表(C语言for循环)
- for循环练习,乘法口诀表和三角形。
- c语言入门:用for循环输出乘法口诀表
- 打印99乘法口诀 一个for循环
- loop与for loop分别实现乘法口诀表
- Java实现乘法口诀表
- java实现乘法口诀表
- 汇编实现乘法口诀表
- java实现乘法口诀表
- python 实现乘法口诀表
- 一层循环输入99乘法口诀表
- AudioTrack
- POJ 2371 Questions and answers
- 91.View the Exhibit to examine the error that occurred during the database startup. You opened an RM
- 事件传递和响应者链条
- 如何做一个基于ASP.NET MVC 网站(三)
- 使用for循环嵌套实现乘法口诀表
- hive的更新和删除操作脚本
- 负载均衡 Nginx LVS HAProxy
- HDU-3533
- init进程【1】——init启动过程
- 判断一个数的奇偶性
- C语言程序设计谭浩强版 五
- The beginning
- The content of the adapter has changed but ListView did not receive a notification的解决方案