HTML & JS
#include<stdio.h>
void main()
{
  int a[10]={21, 34, 45,1};
  int search=21;  //element to be searched
  int n=4;
  printf("\nThe elements of the array:");
  for(int i=0;i<=n-1;i++)
      printf("%d ",a[i]);
  int found=0;
  for(int i=0;i<=n-1;i++)
  {
    if(a[i]==search)
    {
       found=1;
       break;
    }
  }
  if(found==1)
     printf("\nElement found");  
  else
     printf("\nElement not found");
} 

Generated URL:

Output:

The elements of the array:21 34 45 1 
Element found
Report Bug