Problem Simple2

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2002, TopCoder, Inc. All rights reserved.


Problem Statement

Create a class DivDigits and a method divcount which takes as an argument an integer number and returns how many digits in number evenly divide number. Count all occurences of such digits in the number, not just the first. See examples for more information.

Definition

Prototype

public class DivDigits { public int divcount(int num) { // fill in code here } }

Notes

No number is divisible by 0.

Constraints

Examples

  1. 12345
    
    Returns: 3
    
    
    12345 is divisible by 1, 3, and 5.

  2.     
    661232
    
    Returns: 3
    
    

    661232 is divisible by 1 and 2.

  3.    
    52527
    
    Returns: 0
    
    
    

    52527 is not divisible by 5, 2, or 7.

  4. 
    730000000
    
    Returns: 0
    
    
    Nothing is divisible by 0. In this case, the number is also not divisible by 7 or 3.

Owen L. Astrachan
Last modified: Wed Mar 10 15:21:41 EST 2004