See the Problem in this program is the logic.....
The Question is to display all even numbers in an array and count the no of even numbers.....
The counting part is working fine but i cant display the even numbers... Note: Use same Functions..
#include<iostream>
int main()
{usingnamespace std;
int B[100],A[100],i,n,count=0,j=0;
cout<<" Enter the no of numbers you want to enter "<<endl;
cin>>n;
for(i=0;i<n;i++)
{cout<<"Enter number "<<i<<endl;
cin>>A[i];
}
for(i=0;i<n;i++)
{
if(A[i]%2==0)
{count++;
B[j]=A[i];
j++;
}
}
for(;j<=count;j++)
{cout<<" Even no = "<<B[j]<<endl;
}
cout<<" No of even numbers "<<endl<<count;
return 0;
}