Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int sumArr(int ar[], int sz);
- int even_sumArr(int ar[], int sz);
- void main()
- {
- int a[] = {59,63,12,22,1,110,48,17,54,23,64,18,97,37,18};
- int size = sizeof(a) / sizeof(int);
- printf("total sum of array: %d \n", sumArr(a, size));
- printf("total sum of even array and the even num from there: %d %d\n", even_sumArr());
- getch();
- }
- int sumArr(int ar[], int sz)
- {
- int total = 0, i;
- for (i = 0; i<sz; i++)
- total += ar[i];
- return total;
- }
- int even_sumArr(int ar[],int sz)
- {
- int Even_total = 0,countEven=0, i;
- {
- for (i = 0; i<sz; i++)
- if (ar[i] % 2 == 0)
- count++;
- return count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement