solved find digits hackerrank

Signed-off-by: ayham <altffour@protonmail.com>
This commit is contained in:
ayham 2021-05-10 11:29:04 +03:00
parent 2aed29534f
commit 6aed86732b
No known key found for this signature in database
GPG Key ID: 81D38F7122AFCC94
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, res = 0;
cin >> t;
while (t--) {
cin >> n;
string str = to_string(n);
for (auto digit : str)
if (digit-'0' != 0 && n % (digit-'0') == 0) res++;
cout << res << endl; res = 0;
}
return 0;
}