There are two issues.
Keep in mind that after removing the duplicates, you have the total number of entries in your variable count
.
So it'd be easier to do
for(i=0; i < count - 1; i++)
{
for(j=0; j < count - 1 - i; j++)
{
.....
Notice the -1
in the second loop. This prevents the iteration from going out of bounds, since you are using j+1
The second error is simply in your printing loop.
Since you already have the amount of numbers to print stored in count
, change
for(j = 0; j < i; j++)
to
for(j = 0; j < count; j++)