对于初学者的难点应该在于如何将数字一个个的取出来,里边的数据也没有很为难,可以利用函数取出其中的数字
#include<bits/stdc++.h>
using namespace std;
//取出数里的数字并相加
int  tt(int c)
{
    int ss = 0;
    while(c != 0)
    {
        ss += c % 10; //将每个数位上的数字相加
        c /= 10;
    }
    return ss;
}

int main()
{
    int a,b;
    cin >> a >> b;
    int sum = 0;
    for(int i = a;i <= b; i++)
    {
        if(tt(i) % 5 == 0)  sum++; //判断数字总和是不是5的倍数,如果是,sum则+1
    }
    cout << sum << endl;
    return 0;
}