Created
August 2, 2016 21:05
-
-
Save anonymous/aa34e9fe97ff530ffec6fb85638f5a2b to your computer and use it in GitHub Desktop.
Simple Array Sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
// https://www.hackerrank.com/challenges/simple-array-sum | |
int main(){ | |
int n; | |
scanf("%d",&n); | |
int arr[n]; | |
int sum = 0; | |
for(int arr_i = 0; arr_i < n; arr_i++){ | |
scanf("%d",&arr[arr_i]); | |
sum += arr[arr_i]; | |
} | |
printf("%i", sum); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment