从键盘输入三个数,按照从小到大(或从大到小)的顺序输出
程序流程图:
代码:
#include<stdio.h>
void main()
{
float a,b,c,d;
printf("please enter three number:\n ");
scanf("%f,%f,%f",&a,&b,&c);
if(a>b)
{
d=a;
a=b;
b=d;
}
if(a>c)
{
d=a;
a=c;
c=d;
}
if(b>c)
{
d=b;
b=c;
c=d;
}
printf("%f,%f,%f\n",a,b,c);
}
结果: