Friday, January 29, 2016

Algorithms - A very big sum

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
    int n;
    scanf("%d",&n);
    int arr[n];
    for(int arr_i = 0; arr_i < n; arr_i++){
       scanf("%d",&arr[arr_i]);
    }
    long long sum=0;
    for(int arr_i = 0; arr_i < n; arr_i++){
       sum=sum + arr[arr_i];
    }
    printf("%lld\n",sum);
    return 0;
}

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)