LENEAR SERACH IN C
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int arr[5]={ 1,2,3,4,5};
int found =0;
int ele;
printf("Enter element for the fiinding \n:");
scanf("%d",&ele);
for(int i=0;i<6;i++)
{ if(arr[i]==ele){
printf("Element found at location %d ",i+1);
found =1;
break; }
}
if(!found){
printf("\nElement not found ");
}
getch();
}
Comments
Post a Comment