OCJP

Odd and Even Numbers

#include<stdio.h>
#include<conio.h>
void main()
{
int n[10],i,a,b;
int odd[6],even[6];
clrscr();
a=0;
b=0;

for(i=0;i<6;i++)
{
printf("\n enter the number:");
scanf("\n %d",&n[i]);
	if(n[i]%2==0)
	even[a++]=n[i];
	else

	odd[b++]=n[i];


}

printf("\nEven Nos :");
for(i=0;i<a;i++)
printf("\n\t%d ",even[i]);

printf("\nOdd Nos :");
for(i=0;i<b;i++)
printf("\n\t%d",odd[i]);

getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *


× How can I help you?