Write a program to print out the following pattern. ********* ======= ***** === *
时间: 2023-08-29 16:06:59 浏览: 143
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()
for i in range(2):
for j in range(5):
print("*", end="")
print()
for i in range(1):
for j in range(1):
print("*", end="")
print()
```
Output:
```
*********
*********
*********
*****
*****
*
```
Write a C program to print out the following pattern. ********* ======= ***** === *
以下是C语言程序,用于打印出给定的图案:
```c
#include <stdio.h>
int main() {
printf("*********\n");
printf("=======\n");
printf("*****\n");
printf("===\n");
printf("*?\n");
return 0;
}
```
阅读全文