Binary subtraction

Hello guys
I am currently trying to implement a algorithm for binary subtraction to pass my test cases, but i am having issues debugging my problem when i run the test cases.
what I have written is attached below. Any help is kindly appreciated. Thank you
#include <stdio.h>

int main(void)
{
int borrow, i, n, xi, yi, j, xj, difference;
borrow = 0;

for (i = 0; n-1;)
if(yi <= xi)
{
difference = xi-yi;
}
while (xj = 0 && j < n)
{
j = j + 1;
if (j = n)
borrow = 1;
j = j - 1;
xj = xj + 10;
}
while (j > i)
{
xj = xj - 1;
j = j - 1;
xj = xj + 10;

difference = xi - yi;
}


return 0;
}
hello321 wrote:
implement an algorithm

Which algorithm? Write it down. Better still, post it here.

hello321 wrote:
pass my test cases

What test cases?

hello321 wrote:
i am having issues debugging my problem

Your code makes no sense and all variables (with the honourable exception of "borrow") have no assigned value ... so there's not a lot you can do to them.

While we're at it ...
#include <stdio.h>
Use either <cstsdio> or <iostream>

It is
int main()
not
int main(void)

Please put your code in code tags.


Your main problem is that you are simply not explaining what you are trying to do, and your code is not such that we could guess.
Topic archived. No new replies allowed.