编写程序,用循环结构输出如下图形: * *** ***** *** *
时间: 2023-08-28 08:07:50 浏览: 246
c代码-编写程序输出下列图形: * *** ***** *******
```python
for i in range(1, 6):
for j in range(1, 6-i):
print(" ", end="")
for k in range(1, 2*i):
print("*", end="")
print()
for i in range(4, 0, -1):
for j in range(1, 6-i):
print(" ", end="")
for k in range(1, 2*i):
print("*", end="")
print()
```
输出结果为:
```
*
***
*****
*******
*********
*******
*****
***
*
```
阅读全文