#include<iostream.h>
#include<conio.h>
void sum(int a[],int n);
void main()
{
clrscr();
int a[10],n,i;
cout<<"\n\n";
cout<<"enter size";
cout<<"\n\n";
cin>>n;
cout<<"\n";
cout<<"enter elements";
cout<<"\n";
for(i=0;i<n;i++)
{
cout<<"\n";
cin>>a[i];
}
sum(a,n);
getch();
}
void sum(int a[],int n)
{
int i,sum=0;
cout<<"\n";
cout<<"even nos. are";
cout<<"\n";
for(i=0;i<n;i++)
{
if(a[i]%2==0)
{
cout<<a[i]<<"\t,";
sum=sum+a[i];
}
}
cout<<"\n\n";
cout<<"sum is\n"<<sum;
}
#include<conio.h>
void sum(int a[],int n);
void main()
{
clrscr();
int a[10],n,i;
cout<<"\n\n";
cout<<"enter size";
cout<<"\n\n";
cin>>n;
cout<<"\n";
cout<<"enter elements";
cout<<"\n";
for(i=0;i<n;i++)
{
cout<<"\n";
cin>>a[i];
}
sum(a,n);
getch();
}
void sum(int a[],int n)
{
int i,sum=0;
cout<<"\n";
cout<<"even nos. are";
cout<<"\n";
for(i=0;i<n;i++)
{
if(a[i]%2==0)
{
cout<<a[i]<<"\t,";
sum=sum+a[i];
}
}
cout<<"\n\n";
cout<<"sum is\n"<<sum;
}