bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / tuition-c / APC-S-011.c

APC-S-011.c (758B)


      1 /* Linear search */
      2 /* Author: Amit Dutta, Date: 19-11-2025 */
      3 
      4 #include <stdio.h>
      5 
      6 int main()
      7 {
      8     int elementCount, i, keyElement;
      9 
     10     printf("Enter the number of element you want to add: ");
     11     scanf("%d", &elementCount);
     12 
     13     int elements[elementCount];
     14 
     15     for (i = 0; i < elementCount; i++)
     16     {
     17         printf("Enter Element %d: ", i + 1);
     18         scanf("%d", &elements[i]);
     19     }
     20 
     21     printf("\nEnter the Key Element you want to search: ");
     22     scanf("%d", &keyElement);
     23     for (i = 0; i < elementCount; i++)
     24         if (elements[i] == keyElement)
     25         {
     26             printf("\nKey Element %d is found in %d position.", keyElement, i);
     27             return 0;
     28         }
     29     printf("\nKey Element %d is not found.", keyElement);
     30     return 0;
     31 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror