#include <stdio.h>
int Count_Digit(const int N, const int D);
int main()
{
int N, D;
scanf("%d %d", &N, &D);
printf("%d\n", Count_Digit(N, D));
return 0;
}
int Count_Digit(const int N, const int D)
{
int i, j, b = 0;
i = N;
if (i < 0)
i = -i;
do
{
j = i % 10;
if (j == D)
b++;
i /= 10;
} while (i > 0);
return b;
}
基础编程题目集 6-9 统计个位数字 (15分)
最新推荐文章于 2022-04-21 02:42:47 发布