输入一个正整数n,找出其中最小数字,用该数字组成一个新数,新数的位数与原数相

学习 时间:2026-04-02 17:14:13 阅读:2190
输入一个正整数n,找出其中最小数字,用该数字组成一个新数,新数的位数与原数相输入一个正整数n,找出其中最小数字,用该数字组成一个新数,新数的位数与原数相同。运行示例:Enter an integer:2187The new integer:1111C语言编程作业

最佳回答

鳗鱼流沙

冷酷的悟空

2026-04-02 17:14:13

#include “stdio。h”void main(){int x,minnum,t,len;printf("Enter an integer:");scanf("%d",&x);minnum=x%10;len=1;while(x>=10){x=x/10;t=x%10;len++;if(t0){t=10*t+minnum;len--; }printf("The new Integer:%d\n",t);}

最新回答共有2条回答

  • 满意的芝麻
    回复
    2026-04-02 17:14:13

    #include “stdio。h”void main(){int x,minnum,t,len;printf("Enter an integer:");scanf("%d",&x);minnum=x%10;len=1;while(x>=10){x=x/10;t=x%10;len++;if(t0){t=10*t+minnum;len--; }printf("The new Integer:%d\n",t);}

上一篇 He isn't as taller as his brother.改错

下一篇 最浪漫的句子..英文的中文的都要