APC-S-011.c (894B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Linear search */ 8 /* Author: Amit Dutta, Date: 19-11-2025 */ 9 10 #include <stdio.h> 11 12 int main() 13 { 14 int elementCount, i, keyElement; 15 16 printf("Enter the number of element you want to add: "); 17 scanf("%d", &elementCount); 18 19 int elements[elementCount]; 20 21 for (i = 0; i < elementCount; i++) 22 { 23 printf("Enter Element %d: ", i + 1); 24 scanf("%d", &elements[i]); 25 } 26 27 printf("\nEnter the Key Element you want to search: "); 28 scanf("%d", &keyElement); 29 for (i = 0; i < elementCount; i++) 30 if (elements[i] == keyElement) 31 { 32 printf("\nKey Element %d is found in %d position.", keyElement, i); 33 return 0; 34 } 35 printf("\nKey Element %d is not found.", keyElement); 36 return 0; 37 }