代码这样写就对了:
main(void)
{
int a,b,c,sun;
printf("请输入3个数:\n");
scanf("%d,%d,%d",&a,&b,&c);
if(a>b)
{
sun=a;
a=b;
b=sun;
}
if(a>c)
{
sun=a;
a=c;
c=sun;
}
if(b>c)
{
sun=c;
c=b;
b=sun;
}
printf("从小到大的顺序是:%d,%d,%d",a,b,c);
}
main(void)
{
int a,b,c,sun;
printf("请输入3个数:\n");
scanf("%d,%d,%d",&a,&b,&c);
if(a>b)
{
sun=a;
a=b;
b=sun;
}
if(a>c)
{
sun=a;
a=c;
c=sun;
}
if(b>c)
{
sun=c;
c=b;
b=sun;
}
printf("从小到大的顺序是:%d,%d,%d",a,b,c);
}