1、题目:从低位开始取出长整形变量s中奇数位上的数,一次构成一个新数放在t中。高位仍为高位,低位仍为地位。例如,当s中的数为:7654321时,t为7531.
2、代码
#include<stdio.h>
void fun(long s,long *t)
{
long s1=10;
*t=s%10;
while(s>0)
{
s=s/100;
*t=s%10*s1+*t;
s1=s1*10;
}
}
int main()
{
long s,t;
printf("\nPlease enter s:");
scanf("%ld",&s);
fun(s,&t);
printf("The result is : %d",t);
}
3、运行结果