// Write a programe to print odd and even numbers,using array //
#include<stdio.h>
#include<conio.h>
#define MAX 100 // User define function //
void main()
{
int a[MAX],i,l;
clrscr();
printf("Enter the size\n");
scanf("%d",&l);
printf("Enter the values\n");
for(i=1;i<=l;i++)
{
scanf("%d",&a[i]);
}
printf("Even numbers are\n");
for(i=1;i<=l;i++)
{
if(a[i]%2==0)
{
printf("%d\n",a[i]);
}
}
printf("Odd number\n");
for(i=1;i<=l;i++)
{
if(a[i]%2!=0)
{
printf("%d\n",a[i]);
}
}
getch();
}
No comments:
Post a Comment