How to come up with formula to get minimum sell price to profit on commodity exchange I'm stuck trying to come up with an equation that will calculate the minimum sale price of a commodity (such as Bitcoin) in order to at least break even. That in it of itself is no problem, sell for same price it was purchased for at the minimum.
The issue I'm running into is, based on my several searches, one variable is dependent on another variable. To be specific, if I purchase something for $100, with .5% of the purchase being a fee, how do I figure out what my sale price of that same quantity will need to be in order to break even? If I'm thinking about this correctly, my independent variable is sale price, while the dependent variable is the sale fee. I've tried different things, but I can't seem to get the result I'm looking for. I'll use the following variables:
a =  purchase price
b =  purchase fee (constant, 0.5% or 0.005)
c =  sale price
d =  sale fee (constant, 0.5% or 0.005)

The first equation I come up with, and with the help of online formula solver to simplify:
$$c = (a * (1 + b)) / (1 + d).$$
But the fee is not supposed to be additive, this comes out of the purchase and sale prices
$$(c - (c * .005)) - (a - (a * .005)).$$
But I don't even know what c is. So if I use the online formula solver to solve for c, I get:$$ c = a.$$
I can trial and error in a spreadsheet until I get my profit to show $0.00 so I know what my minimum sale price is. But trying to convert that into a C# program is proving to test my limited knowledge in math. Can anybody point me in the right direction on how to logic this out to the point I can program it?
 A: I find the math a bit easier to work with starting with the purchase price and the sales price as your variables. So,  let's say you buy at a purchase price of $a=100$,  which means $b=.50$ and you have spent $100.50$ and have $100$ nominal value.   If you sell at price $c$ you have to pay $.005c$ as a fee, so you only earn back $c-.005c=.995c$ in return.   So if you want to make $100.50$,  we can set $100.50=.995c$ and solve for $c$ getting $c=\frac {100.50} {.995}\approx 101.005025$
Now we can replace the $100.50$ in this example with a generic purchase price of $a$ and a sales fee of $.005$ meaning you have spent $1.05a$  Setting that equal to $.995c$ we get
$$1.05a=.995c$$
$$c=\frac {1.05} {.995}a\approx 1.010050251a$$
So the price has to go up by a little over $1\%$ for you to break even, which makes sense, you have to cover the two $.5\%$ costs plus the little bit extra where the fees effectivly overlap
Generalizing this for other fees $b$ and $d$ written in decimal, we get
$$c=\frac {1+b} {1-d}a$$
