编写函数long fun(long x),将长整型参数x中每一位上为偶数的数依次取出,构成一个新数返回.例如:下面程序运行时输入:124578902,程序输出:24802. #includelong fun(long x) { }void main() { long a,b; printf("E

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/11 16:39:06
编写函数long fun(long x),将长整型参数x中每一位上为偶数的数依次取出,构成一个新数返回.例如:下面程序运行时输入:124578902,程序输出:24802.    #includelong fun(long x)  {  }void main()  { long a,b; printf(
xRJ@|RL*֚[xIlfb)VBEDP}lOk~Fŋ=|ësSh d &1w*OS-[DRִ q߶vm7 18)566ڥV٩J+!?ħIg2gKwM_s{ѽ;NͰv\2r- )j( PQq-Ub1};oDYƒ7țMH4 TPDIK~eQ@21zTQ^ !--QW&XZoڲIb<h,9a2qĄ4é_"4I/h(X4E /1@3+&

编写函数long fun(long x),将长整型参数x中每一位上为偶数的数依次取出,构成一个新数返回.例如:下面程序运行时输入:124578902,程序输出:24802. #includelong fun(long x) { }void main() { long a,b; printf("E
编写函数long fun(long x),将长整型参数x中每一位上为偶数的数依次取出,构成一个新数返回.
例如:下面程序运行时输入:124578902,程序输出:24802.
#include
long fun(long x)
{
}
void main()
{ long a,b;
printf("Enter a number:");
scanf("%ld",&a);
b=fun(a);
printf("b=%ld\n",b);
}

编写函数long fun(long x),将长整型参数x中每一位上为偶数的数依次取出,构成一个新数返回.例如:下面程序运行时输入:124578902,程序输出:24802. #includelong fun(long x) { }void main() { long a,b; printf("E
#include
long fun(long x)
{
int n=10,m=0;
while (x)
{
int t=x%10;
if(t%2==0)
{
m+=t*n/10;
n*=10;
}
x/=10;
}
return m;
}
void main()
{ long a,b;
printf("Enter a number:");
scanf("%ld",&a);
b=fun(a);
printf("b=%ld\n",b);
}