题解 | #数位五五#
数位五五
https://www.nowcoder.com/practice/4306996b0a534178b90b3514a8b30028
#include <stdio.h> int is_five(int i); int main() { int a, b; while (2 == scanf("%d %d", &a, &b)) { int count = 0; for (int i = a; i <= b; i++) { if (is_five(i)) { count++; } } printf("%d\n", count); } return 0; } int is_five(int i) { int flag = 0; int sum = 0; while (i) { sum += (i % 10); i /= 10; } if (sum % 5 == 0) { return 1; } else { return 0; } }