{
int x;
int count=0;
int temp=0;
x=N;
if(x<0)
x=-x;
do
{
temp=x%10;
if(temp==D)
count++;
x=x/10;
}
while(x>0);
return count;
}
6-3 统计个位数字 (15 分) 本题要求实现一个函数,可统计任一整数中某个位数出现的次数。例如-21252中,2出现了3次,则该函数应该返回3。 函数接口定义: int Count_Digit
最新推荐文章于 2024-03-19 09:33:54 发布