通过while循环一步步实现九九乘法表
# 打印#做出@列的效果
height = int(input("height: ")) #用户输入一个高度
num_height = height
while num_height > 0:
print("@")
num_height -= 1
# 打印#做出@列的效果
width = int(input("width: ")) #用户输入一个宽度
num_width = 1 #第一步 赋值
while num_width <= width: #第二步 num_width == 1
print("#",end="") #第三步 不换行 打印一个#
num_width += 1 #第四步 num_width == 2
print()
# 打印#做出N行X列的效果
height = int(input("height: ")) #用户输入一个高度
width = int(input("width: ")) #用户输入一个宽度
num_height = 1
while num_height <= height:
num_width = 1
while num_width <= width:
print("#",end="")
num_width += 1
print()
num_height += 1
通过前面的铺垫,现在开始尝试打印九九乘法表
#九九乘法表
first = 1
while first <=9:
second = 1
while second <= first:
print(str(second)+"*"+str(first)+"="+str(second*first),end="\t")
second +=1
first +=1
print()
通过while循环一步步实现九九乘法表的更多相关文章
- 编写Java程序,使用循环结构打印出九九乘法表
编写Java程序,使用循环结构打印出九九乘法表 效果如下: 实现代码: public class Multiplication99 { public static void main(String[] ...
- python—用for循环、while循环和一句话打印九九乘法表
用for循环打印九九乘法表: for i in range (1,10): for j in range(1,10): print(j,"x",i,"=",i* ...
- Oracle三种循环例题:打印九九乘法表
数据库SQL三种循环语句(For.While.Loop) --如果要将执行结果输出,需要先执行 setserveroutput on 命令,在窗口里显示服务器输出信息 set serveroutput ...
- For 循环的嵌套与九九乘法表
㈠通过程序,在页面中输入如下图形 * * * * * * * * * * * * * * * * * * * * * * * * * 代码如下: //向body中输入一个内容 //document. ...
- C语言for 循环 9*9 实现九九乘法表
#include <stdio.h> int main(void) { //for循环实现9*9乘法表 /* 1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3=9 */ ...
- 利用js的for循环实现一个简单的“九九乘法表”
For循环九九乘法表 for循环是javascript中一种常用的循环语句,可以很好的解决在程序中需要重复执行某些语句,利用for循环实现简单的“九九乘法表”的效果: 让循环从小到大,依次排序,并计算 ...
- Python中的九九乘法表(for循环)
用for循环写出的九九乘法表(包括函数的调用) #方向一 for i in range(1,10): for j in range(1,i+1): d = i * j ...
- 用for; while...do; do...while; 写出九九乘法表
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 【Java】Java_15 打印九九乘法表
使用For循环嵌套即可打印九九乘法表 以下是具体代码: /** * 打印九九乘法表 */ package com.oliver.test; public class TestMultiplicatio ...
随机推荐
- eclipse搜索类快捷键
习惯的编辑器可以提高编程效率,熟悉的快捷键可以提高工作效率,本文更新eclipse中常用的搜索快捷键 打开资源快捷键:Ctrl+Shift+R 通过在搜索框中输入名字可以很方便的在项目或工作空间中找某 ...
- Linux centosVMware Vim介绍、vim颜色显示和移动光标、vim一般模式下移动光标、vim一般模式下复制、剪切和粘贴
一.Vim介绍 vim 是一款功能强大的文本编辑器,是vi的升级版,带有颜色显示, 默认有三种模式:一般模式, 命令模式, 编辑模式 安装Vim [root@davery ~]# vim /et ...
- Mybatis入门(一)环境搭建
MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyBatis 可以使用简单的 XML ...
- [Verilog] indexed part-select +:
That syntax is called an indexed part-select. The first term is the bit offset and the second term ...
- Lesson 45 Of men and galaxies
In man's early days, competition with other creatures must have been critical. But this phase of our ...
- delphi窗体按钮灰化禁用
1.使最小化按钮变灰:setwindowlong(handle,gwl_style,getwindowlong(handle,gwl_style) and not ws_minimizeb ...
- python机器学习基本概念快速入门
//2019.08.01机器学习基础入门1-21.半监督学习的数据特征在于其数据集一部分带有一定的"标记"和或者"答案",而另一部分数据没有特定的标记,而更常见 ...
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 辅助类:显示和隐藏内容
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- Redis之datatype概述
Redis支持的数据类型 String List Set Sorted Set Hashes Bit array HyperLogLog Bina ...
- Golang编程的工程管理
Golang编程的工程管理 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.