C program to calculate sum of all even numbers in an array.


#include<stdio.h> 
#include<conio.h>
void main()
{
int a[5];
int i,sum=0;
clrscr();
printf("\n enter the array element-");
for(i=0;i<5;i++)
 {
 scanf("\n %d",&a[i]);
 }
for(i=0;i<5;i++)
 {
   if(a[i]%2==0)
            {
               sum=sum+a[i];
               }
 }
printf("\n the sum of even number is %d",sum);
getch();
}
/* output

 enter the array element-
22
55
34
79
11

 the sum of even number is 56 */