## while用法与if格式是一样的,也是4个空格为缩进
## 缩进的就属于子程序,嵌套子程序
![](https://img.kancloud.cn/a1/2a/a12ad0583de096d7121cb4291ce110a1_1433x658.png)
## 99乘法表
~~~
i = 0
while i < 9:
i = i + 1
s=0
print(' ')
while s < i:
s = s + 1
print("%s*%s=%s\t"%(s,i,s*i),end=' ')
~~~
![](https://img.kancloud.cn/7a/e2/7ae255efe0a15f86c3e1079bc2d8c921_2616x1880.png)