Tuesday, January 20, 2015

DISPLAY EVEN NUMBERS OF AN ARRAY

PROGRAM:

#include<stdio.h>

main()

{

int i,n,a[10];

printf("Enter total no. of Elements\n"); scanf("%d",&n);


printf("Enter Array elements one by one\n");

for(i=0;i<n;i++)
scanf("%d",&a[i]);

printf("The even numbers of given array:\n"); for(i=0;i<n;i++)

{
if(a[i]%2==0)

printf("%d\n",a[i]);
}

}

OUTPUT:

Enter total no. of Elements 6

Enter Array elements one by one 98 11 35 61 22 14


The even numbers of given array: 98 22 14

No comments:

Post a Comment