1控制台打印“当前进入加减乘除运算” 2函数命名为:“jiaFa(int x,int y), jianFa(int x,int y), chengFa(int x,int y), chuFa(int x,int y) 3分别写出四个函数的具体实现 4调用加减乘除函数,实现5+5 = 10,5-5=0,5*5=25,5/5=1 输出
时间: 2024-03-08 21:49:11 浏览: 30
jiafa.rar_4 3 2 1_jiafa.com
1. 当前进入加减乘除运算
2. 四个函数命名为:
```python
def jiaFa(x, y):
pass
def jianFa(x, y):
pass
def chengFa(x, y):
pass
def chuFa(x, y):
pass
```
3. 四个函数的具体实现如下:
```python
def jiaFa(x, y):
return x + y
def jianFa(x, y):
return x - y
def chengFa(x, y):
return x * y
def chuFa(x, y):
if y == 0:
return "除数不能为0"
else:
return x / y
```
4. 调用加减乘除函数,实现5+5 = 10,5-5=0,5*5=25,5/5=1 的代码如下:
```python
a = 5
b = 5
print("5 + 5 =", jiaFa(a, b))
print("5 - 5 =", jianFa(a, b))
print("5 * 5 =", chengFa(a, b))
print("5 / 5 =", chuFa(a, b))
```
输出结果为:
```
5 + 5 = 10
5 - 5 = 0
5 * 5 = 25
5 / 5 = 1.0
```
阅读全文