{
int a[80], i, s, n, loc;
clrscr( );
printf(“\nEnter number of elements in the array: “);
scanf(“%d”, &n);
printf(“\nEnter the array elements:”);
for(i=0; i
scanf(“%d”, & a[i]);
printf(“\nEnter the element you want to search:”);
scanf(“%d”, &s);
for(i =0; i
{
if (s = = a[i])
{
loc = i + 1;
printf(“\nElement %d is present at %d location”, s, loc);
break;
}
}
if (i = =n)
printf(“\nElement %d is not present in the list”, s);
getch( );
}
Do'stlaringiz bilan baham: