用C语言编写一个程序,输入a、b、c三个值,输出其中最大值。
时间: 2023-05-26 07:02:04 浏览: 58
```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\n", max);
return 0;
}
```
相关问题
编写一个程序,输入a、b、c三个整数,输出其中最大值 使用c语言代码
以下是使用C语言编写的程序,可以输入a、b、c三个整数,然后输出其中的最大值:
```
#include <stdio.h>
int main() {
int a, b, c;
printf("请输入a、b、c三个整数:\n");
scanf("%d %d %d", &a, &b, &c);
int max = a;
if (b > max) {
max = b;
}
if (c > max) {
max = c;
}
printf("最大值为:%d\n", max);
return 0;
}
```
以上程序会在屏幕上显示一个提示,要求用户输入三个整数a、b、c。然后程序会比较a、b、c的大小,找到最大值并将其输出。
用c语言编写一个程序,要求输入a,b,c三个整数,输出其中的最大值
您好,我可以回答这个问题。以下是用 C 语言编写的程序,可以输入三个整数 a、b、c,然后输出其中的最大值:
```
#include <stdio.h>
int main() {
int a, b, c;
printf("请输入三个整数:\n");
scanf("%d%d%d", &a, &b, &c);
int max = a;
if (b > max) {
max = b;
}
if (c > max) {
max = c;
}
printf("最大值是:%d\n", max);
return ;
}
```
希望能对您有所帮助。
相关推荐
![](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)