/*liner search*/

#include<stdio.h>
#include<conio.h>
void main()
{
int a[100],n,i,item,loc=-1;
clrscr();
printf("\nEnter the number of element:");
scanf("%d",&n);
printf("Enter the number:\n");
for(i=0;i<=n-1;i++)
{
scanf("%d",&a[i]);
}
printf("Enter the no. to be search\n");
scanf("%d",&item);
for(i=0;i<=n-1;i++)
{
if(item==a[i])
{
loc=i;
break;
}
}
if(loc>=0)

printf("\n%dis found in position%d",item,loc+1);
else
printf("\nItem does not exits");
getch();
}

/*output of the program*/

Enter the number of element:5
Enter the number:
1
2
5
6
3
Enter the no. to be search
3

3is found in position5

Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

Program to search an element using binary search.

 

 

 

 

 

 

 

 

 

      

1 Program to search an element using linear search technique.
2 Program to search an element using binary search

 

     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement