Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,k,b;
- int a=0;
- int m = 0;
- cin>>n>>k;
- for(int i=1; i<=n;i++)
- {
- b=i;
- while(b>0)
- {
- m=m + b%10;
- b=b/10;
- }
- if( m % k==0) { a = a + 1;
- cout<<a;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement