整数,变量num1.num2.num3.ifelse从小到大排列
1个回答
展开全部
/*
目的 :实现三个数大小排序
*/
# include <stdio.h>
int main(void)
{
int a, b, c;
int t;
printf("请输入三个数让计算机排列大小(注:以空格键作为分割):");
scanf("%d %d %d",&a, &b, &c);
//假如输入的是 1 2 3
if (a < b)//1 < 2
{
t = a;
a = b;
b = t;
}
if (a < c)//a这时等于2 2 < 3
{
t = a;
a = c;
c = t; //这时a为最大值
}
printf("调试b c 的值%d %d \n",b ,c);
if (b < c)
{
t = b;
b = c;
c = t;
}
printf("%d %d %d \n", a, b, c);
return 0;
}
目的 :实现三个数大小排序
*/
# include <stdio.h>
int main(void)
{
int a, b, c;
int t;
printf("请输入三个数让计算机排列大小(注:以空格键作为分割):");
scanf("%d %d %d",&a, &b, &c);
//假如输入的是 1 2 3
if (a < b)//1 < 2
{
t = a;
a = b;
b = t;
}
if (a < c)//a这时等于2 2 < 3
{
t = a;
a = c;
c = t; //这时a为最大值
}
printf("调试b c 的值%d %d \n",b ,c);
if (b < c)
{
t = b;
b = c;
c = t;
}
printf("%d %d %d \n", a, b, c);
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询