用C帮我写一个两数判断大小的程序
时间: 2023-03-28 08:02:13 浏览: 58
好的,以下是用 C 语言编写的判断两个数大小的程序:
#include <stdio.h>
int main() {
int a, b;
printf("请输入两个整数:\n");
scanf("%d %d", &a, &b);
if (a > b) {
printf("%d 大于 %d\n", a, b);
} else if (a < b) {
printf("%d 小于 %d\n", a, b);
} else {
printf("%d 等于 %d\n", a, b);
}
return ;
}
希望能对您有所帮助。
相关问题
帮我写一个判断三个数大小的c语言程序
好的,以下是判断三个数大小的 C 语言程序:
```
#include <stdio.h>
int main() {
int a, b, c;
printf("请输入三个整数,用空格隔开:");
scanf("%d %d %d", &a, &b, &c);
if (a > b && a > c) {
printf("%d 最大\n", a);
} else if (b > a && b > c) {
printf("%d 最大\n", b);
} else {
printf("%d 最大\n", c);
}
return ;
}
```
希望能够帮到您!
帮我用c语言写一个程序实现三个数大小比较
好的,下面是一个示例程序:
```c
#include <stdio.h>
int main() {
int a, b, c;
printf("请输入三个整数:\n");
scanf("%d %d %d", &a, &b, &c);
if (a > b && a > c) {
printf("%d 最大\n", a);
} else if (b > a && b > c) {
printf("%d 最大\n", b);
} else {
printf("%d 最大\n", c);
}
return 0;
}
```
这个程序会要求用户输入三个整数,然后通过 `if` 和 `else if` 来判断哪个数最大,并输出结果。
相关推荐
![](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)