## 请问为什么我这个代码实现不了这个算法

#include<stdio.h>

int main()
{
int n,m,a,b,c,i,j,k,t;
int chazhi;
printf("输入四位整数");
scanf("%d",&n);
m = n/1000;
printf("m = %d",m);
a = (n%1000)/100;
printf("a = %d",a);
b = (n%100)/10;
printf( "b =%d",b);
c = n%10;
printf("c = %d\n",c);

//顺序排序

int jisuan[]={m,a,b,c};

printf("%d\n",jisuan[0]);
for(i = 0;i<4;i++)
{k = i;
for(j = i+1;j<=4;j++)
{
if(jisuan[k]>jisuan[j])
k = j;
}
if(k != i)
t = jisuan[i];
jisuan[i] = jisuan[k];
jisuan[k] = t;
}
printf("xx = %d\n",jisuan[0]);
int aa;
aa = 1000*jisuan[0] +100*jisuan[1] + 10*jisuan[2] +jisuan[3];
printf("aa = %d\n",aa);

//逆序排序
for(i = 0;i<4;i++)
{k = i;
for(j = i+1;j<=4;j++)
{
if(jisuan[k]<jisuan[j])
k = j;
}
if(k != i)
{t = jisuan[i];
jisuan[i] = jisuan[k];
jisuan[k] = t;}
}
int bb;
bb = 1000*jisuan[0] +100*jisuan[1] + 10*jisuan[2] +jisuan[3];
printf("bb = %d\n",bb);
chazhi = bb - aa ;
printf("chazhi = %d",chazhi);

}

0

0
m

m = n/1000;
printf("m = %d",m);
a = (n%1000)/100;
printf("a = %d",a);
b = (n%100)/10;
printf( "b =%d",b);
c = n%10;
printf("c = %d\n",c);

0