Program to Perform Simple Search Operation.

 

#include<stdio.h>
#include<conio.h>
void main()
{
   int i=0,ser,k=0,j=0;
   clrscr();
   int x[5];
   while(i<5)
   {
      printf("\nENTER NUMBER=>");
      scanf("\n %d",&x[i]);
      i++;
   }
   printf("\n enter search element:");
   scanf("\n %d",&ser);
   while(j<5)
   {
      if(x[j]==ser)
      {
  printf("\n found ");

  k=1;
  break;
      }
      j++;
    }

     if(k==0)
     {
       printf("\n not found....");
     }
getch();
}

Leave a Reply