/*Author-Neelkant.S.Patil,GMIT,Davangere*/
#include<stdio.h>
#include<conio.h>
int e[50],o[50];
void main()
{
int a[50],n,i,j=0,k=0;
clrscr();
printf("\nENTER THE SIZE OF THE ARRAY\n");
scanf("%d",&n);
printf("ENTER THE ELEMENTS OF THE ARRAY\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
e[i]=0;
o[i]=0;
}
for(i=0;i<n;i++)
{
if(a[i]%2==0)
e[j++]=a[i];
else
o[k++]=a[i];
}
printf("EVEN NUMBERS IN THE GIVEN ARRAY ARE\n");
for(i=0;i<99;i++)
{
if(e[i]==0)
break;
else
printf("%d\t",e[i]);
}
printf("\n\nODD NUMBERS IN THE GIVEN ARRAY ARE\n");
for(i=0;i<99;i++)
{
if(o[i]==0)
break;
else
printf("%d\t",o[i]);
}
getch();
}
output-
ENTER THE SIZE OF THE ARRAY
10
ENTER THE ELEMENTS OF THE ARRAY
1
2
3
4
5
6
7
8
9
10
EVEN NUMBERS IN THE GIVEN ARRAY ARE
2 4 6 8 10
ODD NUMBERS IN THE GIVEN ARRAY ARE
1 3 5 7 9
No comments:
Post a Comment