由键盘输入三个整数a、b、c,要求输出其中最大的数。
时间: 2024-01-12 14:05:15 浏览: 32
您好,我可以回答您的问题。以下是我的回答:
可以使用以下代码来实现:
```
a = int(input("请输入第一个整数:"))
b = int(input("请输入第二个整数:"))
c = int(input("请输入第三个整数:"))
if a > b:
if a > c:
print("最大的数是:", a)
else:
print("最大的数是:", c)
else:
if b > c:
print("最大的数是:", b)
else:
print("最大的数是:", c)
```
感谢您的提问!
相关问题
从键盘输入三个整数 a,b,c,输出其中最大的数。
您好,我可以回答您的问题。请看以下代码:
#include <stdio.h>
int main()
{
int a, b, c, max;
printf("请输入三个整数:");
scanf("%d%d%d", &a, &b, &c);
max = a;
if (b > max)
max = b;
if (c > max)
max = c;
printf("最大的数是:%d", max);
return ;
}
以上代码可以实现从键盘输入三个整数 a,b,c,输出其中最大的数。希望能对您有所帮助。
从键盘输入三个整数 a、b、c,输出其中最大的数。
可以使用以下代码实现:
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)