#include<stdio.h>
#include<conio.h>
int main()
{
int list[100],n,x,i,p;
printf("\n enter the size of list");
scanf("%d",&n);
printf("\n enter the elements");
for(i=0;i<n;i++)
scanf("%d",&list[i]);
p=0;
printf("\n enter the element to be search");
scanf("%d",&x);
for(i=0;i<n;i++)
{
if(list[i]==x)
p=i;
}
if(p>0)
{
printf("\nthe element %d is at position %d",x,p+1);
}
else
{
printf("\n wcta");
}
getch();
return 0;
}
#include<conio.h>
int main()
{
int list[100],n,x,i,p;
printf("\n enter the size of list");
scanf("%d",&n);
printf("\n enter the elements");
for(i=0;i<n;i++)
scanf("%d",&list[i]);
p=0;
printf("\n enter the element to be search");
scanf("%d",&x);
for(i=0;i<n;i++)
{
if(list[i]==x)
p=i;
}
if(p>0)
{
printf("\nthe element %d is at position %d",x,p+1);
}
else
{
printf("\n wcta");
}
getch();
return 0;
}

No comments:
Post a Comment
Note: only a member of this blog may post a comment.