Last active
December 22, 2015 23:59
-
-
Save Embedded-linux/6550585 to your computer and use it in GitHub Desktop.
Sequential Search in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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