一、运行结果;
二、源代码;
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
int main()
{
//初始化变量值;
float a, b, c, t;
//提示用户输入数据;
printf("请输入数据a b c:");
//获取用户输入数据;
scanf("%f %f %f", &a, &b, &c);
//判断运算比大小;
//比较a, b的值;
if (a > b)
{
//交换a, b的值;
t = a;
a = b;
b = t;
}
//比较a, c的值;
if (a > c)
{
//交换a, c的值;
t = a;
a = c;
c = t;
}
//比较b, c的值;
if (b > c)
{
//交换b, c的值;
t = b;
b = c;
c = t;
}
//输出结果;
printf("按从小到大的顺序排列的结果是:%5.2f<%5.2f<%5.2f\n", a, b, c);
return 0;
}
三、N-S流程图;