Do you know that knowledge of middle-school arithmetic is a very basic prerequisite for going to computing?
If x = k × y, k ≠ 0,
y = (1/k) × x.
By the way, where do you get this
k
? It's always changing, every working day.
If you cannot sort out your code based on such things, go back to school or just give up. I'm really sorry to say that, but this is well below the typical level of even the beginners asking CodeProject questions. If just the code is messed up, use the debugger and three input values you can easily check up, test values on each step.
Good luck,
—SA