Hello, I've been learning C# for a few months now and still learning, I come from a PHP background where declaring the variable types is not involved.
I would like to do this simple math problem in C#, is there anyone who can help me?
Number A: Is a monetary value with dollars and cents (eg 199.95)
Number B: Is a numerical percentage value (eg 90%) without the percent sign
My code here returns $17995.50 when the answer I am looking for is $179.95
I would like to do this simple math problem in C#, is there anyone who can help me?
Number A: Is a monetary value with dollars and cents (eg 199.95)
Number B: Is a numerical percentage value (eg 90%) without the percent sign
My code here returns $17995.50 when the answer I am looking for is $179.95
Code:
decimal DollarAmt = 199.95; int PercentAmt = 90; decimal result = DollarAmt * PercentAmt ; //returns bad result of 17995.50 - help! Response.Write(result);
Comment