C语言:将三个数从大到小输出

C语言:将三个数从大到小输出_第1张图片C语言:将三个数从大到小输出_第2张图片


#include
int main()
{
	int a = 0;
	int b = 0;
	int c = 0;
	printf("请输入abc的值:");
	scanf_s("%d%d%d", &a, &b, &c);
	if (b > a)
	{
		int tmp = a;
		a = b;
		b = tmp;
	}
	if (c > a)
	{
		int tmp = a;
		a = c;
		c = tmp;
	}
	if (b < c)
	{
		int tmp = c;
		c = b;
		b = tmp;
	}
	printf("%d>%d>%d", a, b, c);
	return 0;
}

你可能感兴趣的:(c语言,开发语言)