#include<stdio.h>
int linear_search(int n)
{
int a[1000] , search, i , num;
num=n;
printf(" \n Enter the elements in the array : \t");
for(i=0 ; i<num; i++)
{
scanf("%d",&a[i]);
}
printf("\n Enter the number to be searched :\t");
scanf("%d",&search);
for(i=0 ; i,num ; i++)
{
if(a[i]==search)
{
printf(" It is present at location %d",i+1);
break;
}
}
if(i ==num)
{
printf("The number is not present");
}
return 0;
}
int main()
{
int n , x;
printf(" Enter the number of elements : \t");
scanf("%d",&n);
x = linear_search(n);
return 0;
}
OUTPUT : -
Follow
Me On Social Media :-
INSTA photography page :- https://www.instagram.com/photo_mania_hub/
Twitter link : - https://twitter.com/ApurbaKhanra199
Facebook page link (Crazy Coders) :-https://www.facebook.com/codercrazy/?modal=admin_todo_tour
Insta photography link :- https://www.instagram.com/photo_mania_hub/
Facebook link :- https://www.facebook.com/profile.php?id=100009747586288
FB photography page :-
https://www.facebook.com/photomaniahub/?modal=admin_todo_tour
For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/
0 Comments