功能是:依次取出正长整型变量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/07/04 23:06:12
![功能是:依次取出正长整型变量s中偶数位上的数,构成一个新数放在t中#includevoid fun(long s,long t){long s1=10;s/=10;*t=s/10;while(s0){fun(s,&t);printf(](/uploads/image/z/3177267-51-7.jpg?t=%E5%8A%9F%E8%83%BD%E6%98%AF%EF%BC%9A%E4%BE%9D%E6%AC%A1%E5%8F%96%E5%87%BA%E6%AD%A3%E9%95%BF%E6%95%B4%E5%9E%8B%E5%8F%98%E9%87%8Fs%E4%B8%AD%E5%81%B6%E6%95%B0%E4%BD%8D%E4%B8%8A%E7%9A%84%E6%95%B0%2C%E6%9E%84%E6%88%90%E4%B8%80%E4%B8%AA%E6%96%B0%E6%95%B0%E6%94%BE%E5%9C%A8t%E4%B8%AD%23includevoid+fun%28long+s%2Clong+t%29%7Blong+s1%3D10%3Bs%2F%3D10%3B%2At%3Ds%2F10%3Bwhile%28s0%29%7Bfun%28s%2C%26t%29%3Bprintf%28%22%25ld%5Cn%22%2Ct%29%3B%7Delseprintf%28%22s+value+error%5Cn%22%29%3B%7D)
功能是:依次取出正长整型变量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;
}
}