写一个程序,输入a、b、c三个整数,输出其中最大值。
时间: 2023-03-21 17:03:13 浏览: 128
以下是Python代码实现:
```python
a = int(input("请输入整数a:"))
b = int(input("请输入整数b:"))
c = int(input("请输入整数c:"))
if a >= b and a >= c:
print("最大值为:", a)
elif b >= a and b >= c:
print("最大值为:", b)
else:
print("最大值为:", c)
```
解释:首先通过`input()`函数分别获取用户输入的三个整数,然后使用条件语句判断哪个整数是最大值,最后通过`print()`函数输出结果。
相关问题
写一个程序,输入a、b、c三个整数,输出其中最大值python
Sure! 这是一个简单的 Python 代码实现:
```
a = int(input("请输入 a 的值:"))
b = int(input("请输入 b 的值:"))
c = int(input("请输入 c 的值:"))
if a >= b and a >= c:
print("最大值是:", a)
elif b >= a and b >= c:
print("最大值是:", b)
else:
print("最大值是:", c)
```
希望对你有帮助!
编写一个c语言程序,输入a,b,c三个整数,输出其中最大值
```c
#include<stdio.h>
int main(){
int a, b, c, max;
printf("请输入a,b,c三个整数:");
scanf("%d%d%d", &a, &b, &c);
max = a;
if(b > max){
max = b;
}
if(c > max){
max = c;
}
printf("最大值为:%d\n", max);
return 0;
}
```