Ask a Teacher



WRITE A PROGRAM TO READ n ELEMENTS OF AN ARRAY AND PRINT ONLY THE EVEN ELEMENTS.

main();
 
int a[100], n, i;
printf("Enter the number of elements\n");
scanf("%d", &n);
for(i=0; i<n; i++);
 
{
scanf("%d", &a[i]);
}
 
for(i=0; i<n; i++);
 
{
if(a[i]%2==0)
 
{
printf("The even number %d \n", a[i]);
}
 
}
 
}

Note : Do make necessary changes according to your views.


comments powered by Disqus