功能是:依次取出正长整型变量s中偶数位上的数,构成一个新数放在t中#includevoid fun(long s,long t){long s1=10;s/=10;*t=s/10;while(s0){fun(s,&t);printf("%ld\n",t);}elseprintf("s value error\n");}
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 10:04:22
功能是:依次取出正长整型变量s中偶数位上的数,构成一个新数放在t中#includevoid fun(long s,long t){long s1=10;s/=10;*t=s/10;while(s0){fun(s,&t);printf("%ld\n",t);}elseprintf("s value error\n");}
功能是:依次取出正长整型变量s中偶数位上的数,构成一个新数放在t中
#include
void fun(long s,long t)
{
long s1=10;
s/=10;
*t=s/10;
while(s0)
{
fun(s,&t);
printf("%ld\n",t);
}
else
printf("s value error\n");
}
功能是:依次取出正长整型变量s中偶数位上的数,构成一个新数放在t中#includevoid fun(long s,long t){long s1=10;s/=10;*t=s/10;while(s0){fun(s,&t);printf("%ld\n",t);}elseprintf("s value error\n");}
void main()
{
long s,t=0;
scanf("%ld",&s);
if(s>0)
{
fun(s,&t);
printf("%ld\n",t);
}
else
printf("s value error\n");
}
void fun(long s,long *t)
{
long s1=1;
while(s>0)
{
s = s/10;
*t = s%10 * s1 + *t;
s /= 10;
s1 *= 10;
}
}