功能是:依次取出正长整型变量s中偶数位上的数,构成一个新数放在t中

功能是:依次取出正长整型变量s中偶数位上的数,构成一个新数放在t中
#include
void fun(long s,long t)
{
long s1=10;
s/=10;
*t=s/10;
while(s0)
{
fun(s,&t);
printf("%ldn",t);
}
else
printf("s value errorn");
}
6500fencer 1年前 已收到1个回答 举报

dannyyeah 幼苗

共回答了14个问题采纳率:92.9% 举报

void main()
{
long s,t=0;
scanf("%ld",&s);
if(s>0)
{
fun(s,&t);
printf("%ldn",t);
}
else
printf("s value errorn");

}
void fun(long s,long *t)
{
long s1=1;
while(s>0)
{
s = s/10;
*t = s%10 * s1 + *t;
s /= 10;
s1 *= 10;
}
}

1年前

4
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 17 q. 0.691 s. - webmaster@yulucn.com