I need some help to improve my code.
My code is duplicating the output, and the output format is not what I want.

Here is the full Pseudo code.
Code:
int binary = 0;
int sum;

while(binary<256)
sum = 0;
for(go through all 8 digits)
    if the i-th digit is 0
        sum += i
    if the i-th digit is 1
        sum -= i
end for

if sum == 0
...