Advertisement
minnera

#30daysofcode #day19

Oct 26th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.26 KB | None | 0 0
  1. //https://www.hackerrank.com/challenges/30-interfaces/
  2.  
  3. //Write your code here
  4. class Calculator : AdvancedArithmetic
  5. {
  6.     public int divisorSum(int n){
  7.         int sum = 0;
  8.         for(int i = 1; i <= n; i++){
  9.             if(n % i == 0){
  10.                 sum += i;
  11.             }
  12.         }
  13.         return sum;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement