题目样式
#include<math.h>
int asize(int x)//判断位数
{
int count=1;
while(x>=10)
{
count++;
x=x/10;
}
return count;
}
void fun (int x, int *px)
{
int t=x;//没有找到时返回t
int s=0;
*px=0;//内容初始化为0
int j=0;//记录10的次方数
int count=asize(x);
for(;count>0;count--)
{
s=x%10;
x=x/10;
if(s%3==0)
{
if(j==0)
{
*px=s;
j++;
}
else
{
*px=*px+s*pow(10,j);
j++;
}
}
}
if(*px==0)*px=t;
}
(✿◡‿◡)
方法二:(把int弄成char【】,得到结果后,把char【】弄成int)
#include<math.