Skip to content
This repository was archived by the owner on Dec 29, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions c-linear-search/c-linear-search-2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

int main()
{
int arr[100], i, num, n, c=0, pos;
int arr[100], i, num, n;
printf("Enter the array size : ");
scanf("%d", &n);
printf("Enter the Array Elements : ");
Expand All @@ -16,19 +16,11 @@ int main()
{
if(arr[i]==num)
{
c=1;
pos=i+1;
break;
printf("%d found at the position %d", num, i+1);
return 0;
}
}
if(c==0)
{
printf("Number cannot be found..!!");
}
else
{
printf("%d found at the position %d", num, pos);
}


printf("Number cannot be found..!!");
return 0;
}