比较大小

本题要求将输入的任意3个整数从小到大输出。

输入格式:

输入在一行中给出3个整数,其间以空格分隔。

输出格式:

在一行中将3个整数从小到大输出,其间以“->”相连。

输入样例:

4 2 8



结尾无空行

输出样例:

2->4->8



结尾无空行

answer

#include <stdio.h>
int main(){
	int one,two,three,t;
	scanf("%d %d %d",&one,&two,&three);
	if(one > two) {
		t = one;
		one = two;
		two = t;		
	}
	if(one > three) {
		t = one;
		one = three;
		three = t;		
	}
	if(two > three) {
		t = two;
		two = three;
		three = t;				
	}
	printf("%d->%d->%d",one,two,three);
	return 0;
}
posted @ 2021-10-10 21:18  ekertree  阅读(140)  评论(0)    收藏  举报