Skip to content

Instantly share code, notes, and snippets.

@Embedded-linux
Last active December 22, 2015 23:59
Show Gist options
  • Select an option

  • Save Embedded-linux/6550585 to your computer and use it in GitHub Desktop.

Select an option

Save Embedded-linux/6550585 to your computer and use it in GitHub Desktop.
Sequential Search in C
This program is for sequential search
#include <stdio.h>
int main()
{
int key[20],i,s;
int key1;
printf("Enter the no. of elements:\n");
scanf("%d",&s);
printf("Enter %d elements\n",s);
for(i=0;i<s;i++)
scanf("%d",&key[i]);
printf("Ente Key element\n");
scanf("%d",&key1);
for(i=0;i<s;i++)
{
if(key1 == key[i])
printf("\nkey element and index : %d %d \n",key1,i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment