Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int getSum(int* arr, int n) {
- int sum = 0;
- for(int i = 0; i < n; i++) {
- sum += arr[i];
- }
- return sum;
- }
- int main() {
- int a[6] = {3, 2, 6, -1, 0, 7};
- int sum = getSum(a, 6);
- printf("Sum: %d", sum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement