Program to Perform Simple Search Operation

#include<stdio.h>
#include<conio.h>

 void main()
 {

    clrscr();   int ser,k=0,i;

      int x[5];
  for(i=0;i<5;i++)
  {

    printf("\n Enter No : ");
    scanf("%d",&x[i]);
  }

    printf("\n\n Enter Search Element : ");
    scanf("%d",&ser);


     for(i=0;i<5;i++)
     {

    if(x[i]==ser)
    {
       printf("\n Found " );
       k=1;
       break;
     }
     }

       if(k==0)
        printf("\n Not Found....");


        getch();
  }

Leave a Reply