0

this is suppose to be a binary search to return the number of times a number is found in the array.............but for some reason it isnt calculating the correct number of times the number is found....already had my paper and pen out trying to find the error but it aint working ..help me please

//code

```
#include<stdio.h>
int main()
{
int target, mid,size,exit,i,count;
size=10;
count=0;
int array[10]={0,1,2,3,4,5,6,7,8,9};
mid=size/2;
printf("enter the number to be searched for");
scanf("%d",&target);
//to search for and calculate the number of times the number was found//
if(target >= mid)
{
i=mid;
while(i <= size)
{
if (target=array[i])
{
count++;}
i++;
}
}
else
{
i=0;
while(i<mid)
{
if(target=array[i])
{
count++;}
i++;
}
}
if (count>0){//execute if the number search for was found
printf("the number of times %d found is %d times",target,count);
}
else{//execute if number was not found
printf("%d was not found",target);}
scanf("%d",&exit);//to enter a number before the program exit
return 0;
}
```