Note well. See Ross Millikan's comment below; it seems I'm using an incorrect notion of "profit" here.
For an example: suppose the item costs you $\$ $1, and you wanted a $5\%$ profit. If you offer no discounts, you could simply price it at $\$ $1.05, and when a customer buys it you get the $5\%$ profit.
But say you offer a $5\%$ discount for paying cash. If you price the item at $\$ $1.05, then the $5\%$ discount means that if I pay cash, I only need to pay you $1.05 - .05 = 1.00 (rounding down), so instead of the 5 percent profit, you make no money.
If you want to make 5 percent profit even after you give me the discount, that means that you want the advertised price to be such that once you give me the 5% discount, then the discounted price will be \$ $1.05.
So what we want is that the price, after taking 5\% off, will be $\$ $1.05. That is, $\left(1 - \frac{5}{100}\right)P = 1.05.$ Solving for $P$ we get $P = \frac{1.05}{.95} \approx 1.1052$ so you want to price it at either $\$ $1.10 or $\$ 1.11.
Now, let's deal with the problem in abstract and in generality.
So, what is it we want? We want to take the cost C$, and add a certain percentage, $(1+\frac{p}{100})C$ so that, if we take $x\%$ off this price, the result will be $(1+\frac{y}{100})C$ ($\frac{y}{100}$ because it is $y\% profit).
Now, x$ and $y$ are given and fixed, as is $C$. So what we want is to find the value of $p$ such that: $\Biggl(\left(1 + \frac{p}{100}\right)C\Biggr)\left(1-\frac{x}{100}\right) = \left(1 + \frac{y}{100}\right)C.$ You can cancel $C$, and you end up with the equation $\left(1+\frac{p}{100}\right)\left(1 - \frac{x}{100}\right) = \left(1+\frac{y}{100}\right).$ Now simply express $p$ in terms of $x$ and $y$, and that is the "percentage that should be marked above the cost price so as to make a profit of y% [after the cash discount is taken off]".