Skip to content

Latest commit

 

History

History
35 lines (30 loc) · 356 Bytes

66.md

File metadata and controls

35 lines (30 loc) · 356 Bytes

题目:输入3个数a,b,c,按大小顺序输出。

#include <stdio.h>

void swap(int *p, int *q)
{
	int t;
	t = *p;
	*p = *q;
	*q = t;
}

int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);

	if (a > b)
	{
		swap(&a, &b);
	}
	if (a > c)
	{
		swap(&a, &c);
	}
	if (b > c)
	{
		swap(&b, &c);
	}

	printf("%d %d %d", a, b, c);

	return 0;
}