Below is a simple C program that searches for a given number in an array. The program prompts the user to enter the size of the array, the elements of the array, and the number to be searched. It then prints whether the number is found in the array or not.
Program :
#include <stdio.h>
#include <conio.h>
Â
Â
int main()
{
  int a[10000],i,n,key;
 Â
  printf(“Enter size of the array : “);
  scanf(“%d”, &n);
  printf(“Enter elements in array : “);
  for(i=0; i<n; i++)
  {
    scanf(“%d”,&a[i]);
  }
   printf(“Enter the key : “);
  scanf(“%d”, &key);
  Â
  for(i=0; i<n; i++)
  {
    if(a[i]==key)
    {
printf(“element found “);
      return 0; Â
    }
Â
  }
  Â
printf(“element not found”);
}