关于#c语言#的问题:给定程序c5-2-5.c的功能是:从低位开始取出整型变量s中奇数位上的数,依次构成一个新数放在t中

给定程序c5-2-5.c的功能是:从低位开始取出整型变量s中奇数位上的数,依次构成一个新数放在t中。


/*c5-2-5.c*/
#include <stdio.h>
int main()
{ 
    int s, t, sl=10;
    printf("\nPlease enter s:"); 
    scanf("%d", &s);
    t = s%10;
    while ( s > 0)
    { 
        s = s/100;
        t = s%10 * sl + t;
        sl = sl*10;
    }
    printf("The result is: %d\n", t);
    return 0; 
}

img


咋都问呢,试试看吧,加油!!!
点赞、关注、采纳三连哦亲!!!