#include<stdio.h>
#include<conio.h>
int main()
{
int list[100],n,i,x,p;
printf("enter the size of list");
scanf("%d",&n);
prinf("enter the elements");
for(i=0;i<n;i++)
{
scanf("%d",&list[i]);
}
p=0;
printf("enter the element to be here serch");
scanf("%d",&x);
for(i=0;i<n;i++)
{
if(list[i]==x)
p=i+1;
}
if(p>0)
{
printf("position of element %d is %d",x,p);
}
else
{
printf("try again");
}
return 0;
getch();
}
make p=i+l;
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteprogram is not running here,,,, some problems in machine......but it was giving me output in my room........
ReplyDelete