java__for与do while99乘法
来源:互联网 发布:全球华语网络主播大赛 编辑:程序博客网 时间:2024/06/03 04:08
public class chengfa99 {
public static void main(String[] args) {
// TODO Auto-generated method stub
/* for循环九九乘法
* for (int j = 1; j <= 9; j++) { // 被乘数循环
*
* for (int i = 1; i <= j; i++)
// 乘数循环 实现1*1 1*2 不实现2*3
{
System.out.print(i + "*" + j + "=" + (j * i) + "\t"); // 输出算法1*1 // 1*2
*
* } System.out.print("\n"); // 1*1 换行 1*2 2*2 }
*/
int j = 1; //定义被乘数j
do {
int i = 1; //初始化i使得每次都能进入while循环并且呈现1*n的形态
while (i <= j) { //从1*j~i*j
System.out.print(i + "*" + j + "=" + (j * i) + "\t");
i++;
}
System.out.print("\n"); // 1*1 换行 1*2 2*2
j++;
} while (j <= 9);
// 乘完换行
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
/* for循环九九乘法
* for (int j = 1; j <= 9; j++) { // 被乘数循环
*
* for (int i = 1; i <= j; i++)
// 乘数循环 实现1*1 1*2 不实现2*3
{
System.out.print(i + "*" + j + "=" + (j * i) + "\t"); // 输出算法1*1 // 1*2
*
* } System.out.print("\n"); // 1*1 换行 1*2 2*2 }
*/
int j = 1; //定义被乘数j
do {
int i = 1; //初始化i使得每次都能进入while循环并且呈现1*n的形态
while (i <= j) { //从1*j~i*j
System.out.print(i + "*" + j + "=" + (j * i) + "\t");
i++;
}
System.out.print("\n"); // 1*1 换行 1*2 2*2
j++;
} while (j <= 9);
// 乘完换行
}
}
0 0
- java__for与do while99乘法
- java__for成绩的人数区分与百分比
- do{}while与while()do{}
- java__for switch商品换购
- java__for录入会员信息
- java__for输出棱形
- java__for整除问题
- 串行乘法与并行乘法
- So do I 与 So I do
- do 与 redo
- do- while 与while
- While与do While
- do while与while
- while与do while
- 位移与乘法/除法
- 乘法与位数
- 高精度加法与乘法
- 大数加法与乘法
- 浅谈数据结构--红黑树
- 2017GDCPC赛后总结
- 解决微信端浏览器使用window.location.reload()刷新页面不生效
- 前端数字运算库Math.js
- angularJS中的$interval函数动态显示时间
- java__for与do while99乘法
- 解锁最舒适的startActivity姿势
- 红黑树解析
- Angular开发(十三)-服务的基本认识及利用服务实现组件间的通信
- LwIP学习笔记——STM32 ENC28J60移植与入门
- 百度2017春招笔试真题编程题集合
- 询问用户是哪个年级的同学,对输入的数据进行保存,将结果显示在屏幕上。要求合法年级为1,2,3.自定义异常类GradeExceptio,对输入非法的情况进行异常处理。
- Fedora 安装 gcc-c++
- Ubuntu 安装 wine-qq