quantity Of Factors - Java java.lang

Java examples for java.lang:int

Description

quantity Of Factors

Demo Code


//package com.java2s;

public class Main {
    public static long quantityOfFactors(long number) {
        long quantity = 0;

        for (int i = 1; i <= number; i++) {
            if (isDividedBy(number, i)) {
                quantity++;//from w  w  w .  j  a  va2  s.  c om
            }
        }

        return quantity;
    }

    public static boolean isDividedBy(double dividend, double divisor) {
        return (dividend % divisor == 0);
    }
}

Related Tutorials