C语言程序设计-谭浩强

时间:2020-03-12 14:22:40   收藏:0   阅读:49

比较两个数的大小,并从大到小进行排序

#include<stdio.h>
int main()
{
float a, b, t;
scanf("%f%f", &a, &b);
if (a>b)
{
t = b; //如果a大于b则进行交换
b = a;
a = t;
}
printf("%f %f", a, b);


return 0;
}

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!