C Program Find Sum of Even Numbers in Array

/* C Program to Find Sum of Even numbers in array www.EasyCodeBook.com */ #include <stdio.h> int main() { int array[100],i,n, sum=0; printf("Enter number of elements in array = "); scanf("%d", &n); printf("Enter %d numbers in array\n", n); for (i = 0; i < n; i++) { scanf("%d", &array[i]); if(array[i]%2==0) sum = sum +array[i]; } printf("The sum of even numbers in array is %d",sum); return 0; }

## Output

Enter number of elements in array = 5 Enter 5 numbers in array 20 1 35 60 20 The sum of even numbers in array is 100