Simple Array Sum

Sort by

recency

|

3465 Discussions

|

  • + 0 comments

    Thanks for the solutions, they make the array-sum concept much clearer! I’m also exploring how to adapt this logic for a real project — specifically on my WordPress site for an Insurance service page. Has anyone here tried reusing these algorithms in practical web applications?

  • + 0 comments

    in javascript :

    let sum = 0
        for(let i=0 ; i < ar.length ; i++){
            sum += ar[i]
        }
        return sum
    
  • + 0 comments

    public static int simpleArraySum(List ar) {

    int sum=0;
    for(int i=0;i<ar.size();i++){
        sum+=ar.get(i);
    }
    return sum;
    }
    
  • + 0 comments

    def simpleArraySum(ar): x=0 for i in ar: x=i+x return x

  • + 0 comments

    def simpleArraySum(ar): finalSum = 0 for i in range(len(ar)): finalSum += ar[i] return finalSum

    python