All major conceptual S2 C-Programs with Algorithms
#include <stdio.h>
void main(){
int a[100],i,n,flag=0,search;
printf("Enter size of the array:");
scanf("%d",&n);
printf("Enter the %d elements of the array:", n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("Enter the element to be searched:");
scanf("%d", &search);
for(i=0;i<n;i++){
if(a[i]==search){
flag=1;
break; // important
}
}
if(f==1)
printf("Element %d found at index %d", search, i);
else
printf("Element not found");
}