We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Algorithms
  3. Warmup
  4. A Very Big Sum
  5. Discussions

A Very Big Sum

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • somayaji 4 years ago+ 0 comments

    What's the reason for using two loops and an array? I feel like that just takes too much time and too much space. Here's my take in C if anyone's interested:

    #include <stdio.h>
    
    int main(void){
        int n;
        long sum=0;
        scanf("%d", &n);
        long value;
        //long arr[n];
        for (int i=0; i < n; i++) {
            scanf("%li", &value);
            sum += value;
        }
        printf("%li", sum);
        return 0;
    }
    
    17|
    ParentPermalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature