Problem: Number of Factors


Problem Statement

A factor for a given value is an integer that evenly divide the value (i.e. a divisor with no remainder). This problem asks you to calculate the number of factors for given number. For the purpose of this problem, the number itself or 1 are not counted as factors. That means that a prime number will have 0 factors.

Given an integer, write a function that returns the number of factors for a number..

Definition

Class

public class Count { public int numFactors(int n) { // TODO: fill in numFactors } }

Constraints

Examples

  1. 2
    Returns: 0

  2. 32
    Returns: 4

    The factors are 2, 4, 8, and 16.


Comments?