Saturday, March 17, 2012

Program to find odd and even nos. in an array.

//Program to find odd and even nos. in an array.
#include<stdio.h>
#include<conio.h>
 main()
{
 int n[10],i;
 printf("Enter the 10 no ");
 for(i=0;i<10;i++)
 {
  scanf("%d",&n[i]);
 }
   printf("The even nos: ");
  for(i=0;i<10;i++)
  {
   if(n[i]%2==0)
   {  
    printf("%d,",n[i]);
   }
         }
   printf("\nThe odd nos : ");
   for(i=0;i<10;i++)
   {
   if(n[i]%2!=0)
    { //o[i]=n[i];
   printf("%d,",n[i]);
    }
  
  }

                         
  getch();
}

No comments:

Post a Comment