#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],
i, n, item, loc=-1;
clrscr();
printf(“Enter
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 number to be selected ”);
scanf(“%d”,&item);
for(i=0;i<=n-1;i++)
{
if(item==a[i])
{
loc=i;
break;
}
}
if(loc>=0)
printf(“\n%d
is found in position %d”,item,loc+1);
else
printf(“\nItem
does not exist”);
getch();
}
No comments:
Post a Comment