c语言输入三个个位数输出由这三个数其组成的最大数

代码

第1个回答  2015-04-28
void main(){
int x[3];
printf("Please input the first number:");
scanf("%d",&x[0]);
printf("Please input the second number:");
scanf("%d",&x[1]);
printf("Please input the third number:");
scanf("%d",&x[2]);
int temp;
for (int i=0;i<3;i++)
{
for (int j=i+1;j<3;j++)
{
if (x[i]<x[j])
{
temp = x[i];
x[i] = x[j];
x[j] = temp;
}
}
}
printf("max:%d\n",x[0]*100+x[1]*10+x[2]);
}

本回答被网友采纳
第2个回答  2015-04-28
好歹自己先写一点,太懒了
相似回答