降序排列#include void main(){int a,b,c,d,t;printf("请输入4个数:");scanf("%d,%d,%d",&a,&b,&c);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(a>d){t=a;a=d;d=t;}if(b>c){t=b;b=c;c=t;}if(b>d){t=b;b=d;d=t;}if(c>d){t=c;c=d;d=t;}printf("%d

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 01:59:05

降序排列#include void main(){int a,b,c,d,t;printf("请输入4个数:");scanf("%d,%d,%d",&a,&b,&c);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(a>d){t=a;a=d;d=t;}if(b>c){t=b;b=c;c=t;}if(b>d){t=b;b=d;d=t;}if(c>d){t=c;c=d;d=t;}printf("%d
降序排列
#include
void main()
{
int a,b,c,d,t;
printf("请输入4个数:");
scanf("%d,%d,%d",&a,&b,&c);
if(a>b)
{t=a;a=b;b=t;}
if(a>c)
{t=a;a=c;c=t;}
if(a>d)
{t=a;a=d;d=t;}
if(b>c)
{t=b;b=c;c=t;}
if(b>d)
{t=b;b=d;d=t;}
if(c>d)
{t=c;c=d;d=t;}
printf("%d

降序排列#include void main(){int a,b,c,d,t;printf("请输入4个数:");scanf("%d,%d,%d",&a,&b,&c);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(a>d){t=a;a=d;d=t;}if(b>c){t=b;b=c;c=t;}if(b>d){t=b;b=d;d=t;}if(c>d){t=c;c=d;d=t;}printf("%d
#include
void main()
{
int a,b,c,d,t;
printf("请输入4个数:");
scanf("%d,%d,%d",&a,&b,&c);//scanf("%a,%b,%c,%d",&a,&b,&c,&d);没写入d
if(a>b)
{t=a;a=b;b=t;}
if(a>c)
{t=a;a=c;c=t;}
if(a>d)
{t=a;a=d;d=t;}
if(b>c)
{t=b;b=c;c=t;}
if(b>d)
{t=b;b=d;d=t;}
if(c>d)
{t=c;c=d;d=t;}
printf("%d