Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- int find_sum(int array[], int n)
- {
- int i, sum = 0, a;
- for(i = 0; i < n; i++) {
- a = array[i];
- sum = sum + a;
- }
- return sum;
- }
- int main()
- {
- int array[] = {1,2,3,4,5,6,7};
- int i, count = 0;
- for(auto x: array){
- count++;
- }
- int n = count;
- int sum = find_sum(array, n);
- printf("%d\n", sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement