题解 | #数位五五#
数位五五
http://www.nowcoder.com/practice/4306996b0a534178b90b3514a8b30028
int sum(int a)
{
int b;
int he = 0;
int arr[100] = { 0 };
for (b = 0; a != 0;b++)
{
arr[b] = a % 10;
a /= 10;
he += arr[b];
}
if (he % 5 == 0)
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int a, b,c,d;
int e = 0;
scanf("%d%d", &a, &b);
for (c = a; c <= b; c++)
{
d = sum(c);
if (d == 1)
{
e++;
}
}
printf("%d\n", e);
return 0;
}