编程输出以下字符图形。 * *** ***** ******* ***** *** *
时间: 2023-11-25 09:50:40 浏览: 25
环嵌套
for i in range(1, 10):
for j以下是Python实 in range(1, i+1):
现该字符图形的代码:
``` print('{}x{}python
for i in range(={1}\,t 8'.,format (j2, i):
, print i("*j "), * (( end='')
7 - print i)()
# 方法二: // 2) + "*" * i)
for i使用 in range列表推导(式5,
print0('\,n -'.2join(['):
print\("t "'. *join (((['{}7 -x i{}={) //}'. format2(j), i, + "*" * i i*j))
``` for j in range(1, i
输出结果为:
```
+ *
1)]) ***
for *****
i in*******
**** range(*
1, ***
10 *
)]))
# 方法三:```使用numpy库
import numpy as np
以下是Java实现该字符图形的代码:
```javaprint(np.fromfunction
for (int(lambda i, i = 1 j;: ( i <=j+1)*(i+ 7; i += 21) {
), (9 for (int, j =9)))
#1 方法四; j:使用pandas <= (7 -库 i)
import / 2 pandas as pd
df; j++) {
= pd System.DataFrame([[.out.print("i*j for j ");
in }
range( for1, (int j =10)] for 1 i in range(; j <= i1;, j++) {
System10)])
print(df.to.out.print_string("*");
}
(index=False, header=False))
# System.out.println();
}
方法for五 (:使用int字符串 i =拼 5接;
ifor >= i in range( 1; i -= 2) {
1 for, ( 10int j =):
row1 =; ''
j <= for (7 j - in i range(1, i+1):
) / 2; j++) {
row += System '{}.outx.print{}={}\t'.format("(j ");
}
, for (int j i, i = 1; j <= i;*j)
print(row)
``` j++) {
System.out
C语言代码:
```c.print
("*#include");
< }
stdio.h System>
.out.printlnint main()();
}
``` {
int i, j;
for (
输出结果为:
```
i = *
***
1; **** i*
<=*******
*****
***
9; i++) {
*
for (j =``` 1; j <= i; j++) {
printf("%dx%d=%d\t", j, i, i*j
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_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)
![](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)