用c语言输入三个整数,从小到大输出
时间: 2024-05-09 19:16:52 浏览: 99
c代码-C语言三个数从小到大排序/输出: 任意输入 3 个整数,编程实现对这 3 个整数由小到大进行排序。 冒泡排序的动画 https://haokan.baidu.com/v?vid=8080732080990475789&pd=bjh&fr=bjhauthor&type=video
Sure, here's code for sorting three integers in C:
```
#include <stdio.h>
int main() {
int a, b, c;
printf("Enter three integers: ");
scanf("%d %d %d", &a, &b, &c);
if (a > b) {
int temp = a;
a = b;
b = temp;
}
if (a > c) {
int temp = a;
a = c;
c = temp;
}
if (b > c) {
int temp = b;
b = c;
c = temp;
}
printf("Sorted integers: %d %d %d", a, b, c);
return 0;
}
```
阅读全文