Sort by

recency

|

1668 Discussions

|

  • + 0 comments

    def findDigits(n): count = 0 for i in str(n): if(i=='0'): continue elif(n % int(i) == 0): count += 1 return count

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/iTxLvVxH5pY

    int findDigits(int n) {
        int result = 0, original = n;
        while(n){
            int d = n % 10;
            if(d != 0 && original % d == 0) result ++;
            n /= 10;
        }
        return result;
    }
    
  • + 0 comments

    Perl:

    sub findDigits {
        my $n = shift;
        
        my $cnt = 0;
        my @digits = split("", $n);
        foreach (@digits) {
            next if ($_ == 0);
            $cnt++ if ($n % $_ == 0); 
        }
        return $cnt;
    }
    
  • + 0 comments

    can you find mistake in this code plz??

    include

    using namespace std; int main(){ int n; cin>>n; int result = 0; long long int t; for(int i=0;i>t; } while(t--){ int d=t% 10; if(d!=0 && t%d==0 ) result ++;
    } cout<

  • + 0 comments

    Java solution:

    public static int findDigits(int n) {
            String strN = String.valueOf(n);
            
            int count = 0;
            
            for (char c : strN.toCharArray()) {
                int d = Integer.parseInt(String.valueOf(c));
                
                if (d != 0 && n % d == 0) count++;
            }
    
    
            return count;
        }