首页 > 代码库 > P64

P64

#include<stdio.h>
void fun(long s,long *t)
{
	int d;
	long s1=1;
	*t=0;
	while(s>0)
	{
		d=s%10;
		if(d%2!=0)
		{*t=d*s1+*t;
		s1*=10;
		}
		s/=10;
	}
}
void main()
{
	long s,t;
	printf("\nPlease enter:");
	scanf("%ld",&s);
	fun(s,&t);
	printf("The result is:%ld\n",t);
}