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

2023-12-17 06:03:50


#include<stdio.h>
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;
}

文章来源:https://blog.csdn.net/2301_80727984/article/details/135029052
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。