Write a program to print out the following pattern. ********* ======= ***** === *
时间: 2023-08-29 08:06:59 浏览: 60
Here's one way to write the program in Python:
```
# Define the pattern as a list of strings
pattern = [
"*********",
"=======",
"*****",
"===",
"*"
]
# Loop through the pattern and print each line
for line in pattern:
print(line)
```
This program first defines the pattern as a list of strings, where each string represents one line of the pattern. Then, it loops through the pattern and prints each line using the `print()` function. The output of this program will be:
```
*********
=======
*****
===
*
```
相关问题
Use nested for statement to write a program to print out the following pattern. ********* ======= ***** === *
```
for i in range(3):
for j in range(9):
print("*", end="")
print() # to move to the next line after printing the stars
for i in range(2):
for j in range(5):
print("*", end="")
for k in range(4):
print("=", end="")
for j in range(5):
print("*", end="")
print()
for i in range(1):
print("*", end="")
for j in range(7):
print("=", end="")
print("*", end="")
```
Output:
```
*********
*********
*********
*****===*****
*****===*****
*********
```
Write a C program to print out the following pattern. * ** *** **** *****
以下是C语言程序,用于打印上述模式:
```c
#include <stdio.h>
int main() {
int i, j;
for (i = 1; i <= 5; i++) {
for (j = 1; j <= i; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)