Program to Perform Simple Search Operation use “DO-WHILE” loop

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

  k=1;
  break;
      }
      j++;
    } while(j<5);

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

Leave a Reply