Day 19: Interfaces ( 30 Days of Code)

Input Format:

A single line with an integer, n.

Output Format:

You are not responsible for printing anything to stdout. The locked template code in the editor below will call your code and print the necessary output.

Sample Input

6

Sample Output:

I implemented: AdvancedArithmetic
12

Solution:

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