帮做下这道C语言题

来源:百度知道 编辑:UC知道 时间:2024/06/05 21:11:13
Input three integer numbers a,b and c with comma, then output them in ascending order
在线等

#include <stdio.h>

int main()
{
int a,b,c,temp;
scanf("%d,%d,%d",&a,&b,&c);
if(a>b)
{
temp=a;
a=b;
b=temp;
}
if(a>c)
{
temp=a;
a=c;
c=temp;
}
if(b>c)
{
temp=b;
b=c;
c=temp;
}
printf("%d,%d,%d",a,b,c);
return 0;
}

输入a,b,c三个整数用逗号隔开,然后以顺序输出