题解 | #数位五五#
数位五五
http://www.nowcoder.com/practice/4306996b0a534178b90b3514a8b30028
import java.util.Scanner;
public class Main {
// 计算一个整数的数位之和 14=5
public static int sum(int a) {
int sum = 0;
while (a / 10 != 0 || a % 10 != 0) {
sum += a % 10;
a = a / 10;
}
return sum;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int count = 0;
for (int i = a; i <= b; i++) {
int sum = sum(i);
if (sum % 5 == 0) {
count ++;
}
}
System.out.println(count);
}
}