填空题
下列给定程序中,函数fun的功能是:从低位开始依次取出长整型变量s中奇数位上的数,构成一个新数存放在t中。高位仍在高位,低位仍在低位。
例如,当s中的数为7654321时,t中的数为7531。
请改正程序中的错误,使它能得出正确的结果。
注意:部分源程序在文件MODI1.C中,不得增行或删行,也不得更改程序的结构!
#include <stdio.h>
/* * * * * * * * * * found* * * * * * * * * * /
void fun(long s, long t)
{ longsl=10;
*t=s% 10;
while(s>0)
{s = s/100;
*t = s%10 * sl + *t;
/* * * * * * * * * * found* * * * * * * * * * /
sl=sl*100;
}
}
main( )
{ long s, t;
printf(" /nPlease enter s:"); scanf("%ld", &s);
fun(s, &t);
printf("The result is: %ld/n", t);
}