if(x==i)
can never be true inside the for (x = 0; x < i; x++)
loop, therefore
the while
loop does never terminate.
The if statement has to be moved after the for-loop:
while(i<10){
int r=rand()%10+1;
for (x = 0; x < i; x++)
{
if(array[x]==r){
break;
}
}
if(x==i){
array[i++]=r;
}
}
Also the first loop
for(count=0;count<10;count++){
array[count]=rand()%10+1;
}
is unnecessary because the values are overwritten later.
(If you look-up "random permutation" or "Fisher–Yates shuffle" then you will find more efficient algorithms for producing a non-repeating sequence of random numbers.)