Sort by

recency

|

821 Discussions

|

  • + 0 comments

    c# conditional operator

    public int divisorSum(int n) { int sum=0;

        for(int i=1;i*i<=n;i++)
        {
            var q=Math.DivRem(n,i,out int r);
    
            if(r==0)
            {
                sum+=i!=q?i+q:i;
            }
        }
    
        return sum;
    }
    
  • + 0 comments

    c#

    public int divisorSum(int n) { int sum=0;

        for(int i=1;i*i<=n;i++)
        {
            var q=Math.DivRem(n,i,out int r);
    
            if(r==0)
            {
                sum+=i;
    
                if(i!=q)
                {
                    sum+=q;
                }
            }
        }
    
        return sum;
    }
    
  • + 0 comments

    In Java 8

    import java.io.; import java.util.; interface AdvancedArithmetic{ int divisorSum(int n); } class Calculator implements AdvancedArithmetic { public int divisorSum(int n) { int sum=0; for(int i=1;i<=n;i++) { if(n%i==0) sum+=i; } return sum; } }

  • + 0 comments

    HOW CAN I RECOVER A STOLEN BTC/USDT/ETH? HIRE FIXER WALLET RETRIEVAL Never took much time for me to be able to recover a stolen bitcoin worth of $124k. Reaching out to FIXER WALLET RETRIEVAL, one of the trusted and reputable hackers out here can save you the energy of becoming a stranded victim of crypto fraud. Here is how to contact these hackers; Email fixerwalletretrieval@fixer.co.sit

  • + 0 comments
    class Calculator(AdvancedArithmetic):
        def divisorSum(self, n):
            R=[]
            for i in range(1,n+1):
                if n%i==0:
                    R.append(i)
            return sum(R)