输入4个整数,输出其中最小的数
时间: 2024-05-04 12:16:10 浏览: 14
可以使用以下Python代码实现:
```python
num1 = int(input("请输入第1个整数:"))
num2 = int(input("请输入第2个整数:"))
num3 = int(input("请输入第3个整数:"))
num4 = int(input("请输入第4个整数:"))
min_num = min(num1, num2, num3, num4)
print("最小的数是:", min_num)
```
如果您需要其他编程语言的实现,请告诉我。
相关问题
输入3个整数输出其中最大数
我可以回答这个问题。请看以下代码:
```lua
function max(a, b, c)
if a >= b and a >= c then
return a
elseif b >= a and b >= c then
return b
else
return c
end
end
print(max(1, 2, 3)) -- 输出 3
```
这段代码可以输入三个整数,然后输出其中最大的数。
输入三个整数输出其中最大的数
好的,可以使用以下的 Python 代码实现:
```python
a = int(input("请输入第一个整数:"))
b = int(input("请输入第二个整数:"))
c = int(input("请输入第三个整数:"))
if a >= b and a >= c:
print("最大的数是:", a)
elif b >= a and b >= c:
print("最大的数是:", b)
else:
print("最大的数是:", c)
```
你可以输入三个整数,程序会输出其中最大的数。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.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)
![](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)