In this HackerRank Java Interface problem, you are given an interface AdvancedArithmetic which contains a method signature int divisor_sum(int n). You need to write a class called MyCalculator which implements the interface.

HackerRank Java Interface problem solution

HackerRank Java Interface problem solution

class MyCalculator implements AdvancedArithmetic {
    public int divisorSum(int n){
        int sum = 0;
        for(int d=1; d<=n; d++){
            if(n%d==0)
                sum+=d;
        }
        return sum;
    }
    
}