0

So I need a calculation of the percentage change of a stock and I have also set up the correct formula for it:

int newPrice = 50;
int oldPrice = 100;
int calc = ((newPrice - oldPrice)/Math.Abs(oldPrice))*100;

Logically, the result is a 50% drop compared to the previous stock price. But when I run this calculation and get the result on the console, it shows me "0" every time.

How exactly do I make it show me the correct result? I don't know if I have a logic error somewhere, but so far it looks correct to me.

Sharpo
  • 1
  • 1

0 Answers0