(1)
int sum(int a,int b)
{
return a+b;
}
(2)不知是取出偶数还是取出十位,千位上的数,故写两个程序
long takeout(long a)
{
int b,i=1;
long sum=0;
while(a!=0)
{
b=a%10;
if(b%2==0)
{
sum=b*i+sum;
i=i*10;
}
a=a/10;
}
return sum;
}
long takeout(long a)
{
int b,i=1,k=0;
long sum=0;
while(a!=0)
{
b=a%10;
k++;
if(k%2==0)
{
sum=b*i+sum;
i=i*10;
}
a=a/10;
}
return sum;
}
汗,太多了,不想做了,都不难的,自己多想想吧
void main()
int a b sum
sum=a+b