Răspuns:
#include <iostream>
using namespace std;
int main(){
int n,m,nr=0;
int a,b,c;
cin >> n >> m;
a = n % 10;
b =(n / 10 ) % 10;
c = n / 100;
if(a != 0 && m % a == 0) nr ++;
if(b != 0 && m % b == 0) nr ++;
if(m % c == 0) nr ++;
cout << nr;
}
Explicație: