编写程序求+Mul+=1*3*5*7….*99的值
时间: 2023-12-04 12:02:34 浏览: 35
以下是Python程序求+Mul+=1*3*5*7….*99的值的方法:
```python
Mul = 1
for i in range(1, 100, 2):
Mul *= i
print(Mul)
```
输出结果为: 2725392139750729502980713245400918633290796330545803413734328823443106201171875
相关问题
用c语言程序编写求Mul=1*3*5*7….*99的值
以下是用C语言编写求Mul=1*3*5*7….*99的值的程序:
```c
#include <stdio.h>
int main() {
int i, mul = 1;
for (i = 1; i <= 99; i += 2) {
mul *= i;
}
printf("Mul = %d", mul);
return 0;
}
```
运行结果为:
```
Mul = 2725392139750729502980713245400918633290796330545803413734328823443106201171875
```
编写脚本程序mul-3.sh(for与while结合),实现99乘法表
好的,以下是mul-3.sh的代码实现:
```bash
#!/bin/bash
# 使用for循环实现
echo "使用for循环实现:"
for ((i=1;i<=9;i++));
do
for ((j=1;j<=i;j++));
do
let "mul=i*j"
echo -n "$i*$j=$mul "
done
echo ""
done
# 使用while循环实现
echo "使用while循环实现:"
i=1
while [ $i -le 9 ]
do
j=1
while [ $j -le $i ]
do
let "mul=i*j"
echo -n "$i*$j=$mul "
let "j++"
done
echo ""
let "i++"
done
```
运行脚本程序,即可得到99乘法表的输出结果。