#include<stdio.h>
int main()
{
int array[100];/// declare a 1D Array.
int i,n;
printf("
Please Enter The array size:");
scanf("%d",&n);
printf("
Please Enter %d Element Of the array:
",n);
for(i=0; i<n; i++) ///scan array element
{
scanf("%d",&array[i]);
}
printf("The Even Element of the array:
");
for(i=0; i<n; i++)
{
if(array[i]%2==0)///checking if any number is even or not
{
printf("%d
",array[i]);
}
}
return 0;
}
Output
Please Enter The array size:3
Please Enter 3 Element Of the array:
1 2 87 9 4
The Even Element of the array:
2
4
Add your comment