//searching programme
#include<stdio.h>
#include<conio.h>
int main()
{
int list[100], n,i,x,p;
printf("Enter the size of the list");
scanf("%d",&n);
printf("Enter the element");
for(i=0;i<n;i++)
scanf("%d",&list[i]);
p=0;
printf("Enter the element to search ");
scanf("%d",&x);
for(i=0;i<n;i++)
{
if(list[i]==x)
p=i;
}
if(p>0)
printf("position of element %d is %d",x,p);
else
printf("try again");
return 0;
}
#include<stdio.h>
#include<conio.h>
int main()
{
int list[100], n,i,x,p;
printf("Enter the size of the list");
scanf("%d",&n);
printf("Enter the element");
for(i=0;i<n;i++)
scanf("%d",&list[i]);
p=0;
printf("Enter the element to search ");
scanf("%d",&x);
for(i=0;i<n;i++)
{
if(list[i]==x)
p=i;
}
if(p>0)
printf("position of element %d is %d",x,p);
else
printf("try again");
return 0;
}

//program that search the element and give the output
ReplyDelete//in terms of element and its position.
#include
#include
int main()
{
int list[100], n,i,x,p;
printf("Enter the size of the list");
scanf("%d",&n);
printf("Enter the element");
for(i=0;i=0)//i have change the if condition '>=' with respect to '=' only
printf("position of element %d is %d",x,p);
else
printf("try again");
return 0;
}