Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int findDigits(int n) {
- int count=0;
- int num=0;
- while(n!=0)
- {
- num=n%10;
- if(num!=0 && n%num==0)
- count++;
- n=n/10;
- }
- return count;
- }
- CASE:
- 11
- 123456789
- 114108089
- 110110015
- 121
- 33
- 44
- 55
- 66
- 77
- 88
- 106108048
- CORRECT ANSWERS:
- 3
- 3
- 6
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- 5
- MY ANSWERS:
- 2
- 6
- 4
- 6
- 3
- 2
- 2
- 2
- 2
- 2
- 2
- 4
- if(num!=0 && n%num==0)
- static int findDigits(int n) {
- int count=0;
- int num;
- int number = n;
- while(n > 0)
- {
- num=n%10;
- if(num!=0 && number%num==0)
- count++;
- n=n/10;
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement