简单C程序:给随机三个数由大到小排序,求高手检查错误,#include<stdio.h>int main(){ int a,b,c; printf("Please input three integers:"); scanf("%d%d%d",&a,&b,&c); if(a>=b) if(b>=c)
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/06 01:33:14
简单C程序:给随机三个数由大到小排序,求高手检查错误,#include<stdio.h>int main(){ int a,b,c; printf("Please input three integers:"); scanf("%d%d%d",&a,&b,&c); if(a>=b) if(b>=c)
简单C程序:给随机三个数由大到小排序,求高手检查错误,
#include<stdio.h>
int main()
{
int a,b,c;
printf("Please input three integers:");
scanf("%d%d%d",&a,&b,&c);
if(a>=b)
if(b>=c)
printf("The number from small to large sort is:%d>%d>%d\n",a,b,c);
else
printf("The number from small to large sort is:%d>%d>%d\n",a,c,b);
else if(b>=a)
if(a>=c)
printf("The number from small to large sort is:%d>%d>%d\n",b,a,c);
else
printf("The number from small to large sort is:%d>%d>%d\n",b,c,a);
else if(c>=a)
if(a>=b)
printf("The number from small to large sort is:%d>%d>%d\n",c,a,b);
else
printf("The number from small to large sort is:%d>%d>%d\n",c,b,a);
}
简单C程序:给随机三个数由大到小排序,求高手检查错误,#include<stdio.h>int main(){ int a,b,c; printf("Please input three integers:"); scanf("%d%d%d",&a,&b,&c); if(a>=b) if(b>=c)
你的程序逻辑判断上有问题
你检查下if(a>=b)这个语句里面的if-else语句:
如果a>=b,在b>=c不成立时,并不能说明a>=c>=b