将三个数排序的C语言代码
时间: 2023-05-19 08:03:11 浏览: 96
对于三个数的排序-c语言编程入门教程
以下是将三个数排序的C语言代码:
```
#include <stdio.h>
int main() {
int a, b, c, temp;
printf("请输入三个整数:\n");
scanf("%d %d %d", &a, &b, &c);
if (a > b) {
temp = a;
a = b;
b = temp;
}
if (a > c) {
temp = a;
a = c;
c = temp;
}
if (b > c) {
temp = b;
b = c;
c = temp;
}
printf("排序后的结果为:%d %d %d\n", a, b, c);
return 0;
}
```
阅读全文