Saturday, March 17, 2012

Program for identify +ve and -ve no in an array .

Program for identify +ve and -ve no in an array .


#include<stdio.h>
#include<conio.h>
 main()
{
 int n[15],m,e,i;
 m=n[0];
 printf("Enter the 10 no ");
 for(i=0;i<10;i++)
 {
  scanf("%d",&n[i]);
 }

  printf("\nThe positive no are:\n");
  for(i=0;i<10;i++)
  {
   if(n[i]>0)
   {
    printf("%d,",n[i]);
   }
  }
  printf("\nThe negative no are:\n");
  for(i=0;i<10;i++)
  {
   if(n[i]<0)
   {
    printf("%d,",n[i]);
   }
  }
  getch();
}

No comments:

Post a Comment