Immediate help required-Division in asp.net [Resolved]

Posted by Sina under ASP.NET on 6/26/2012 | Points: 10 | Views : 1686 | Status : [Member] | Replies : 2
I know its silly thing but seriously am not ablt to perform division in asp.net!!!!how to calculate discount % given original value (val1) and discountvalue (val2)
I wrote the code like :
int dp = 1;
dp = ((result / val1) * 100);
When i insert breakpoint, value at dp is shown dp in the 2nd step..
How do we perform division?Am i missing something? While i hover the mouse on / symbol its showing 0, while the result and val variable have the right values. Pl help me..immediately

@Sina


Responses

Posted by: Sina on: 6/26/2012 [Member] Starter | Points: 25

Up
0
Down

Resolved
Resolved!!
The code should be changed to:
decimal dp;
dp = Convert.ToDecimal((Convert.ToDecimal(result) /Convert.ToDecimal( val1)) * 100);

@Sina

Sina, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: hareeshkumarkr-16190 on: 6/26/2012 [Member] Starter | Points: 25

Up
0
Down
Hi
can you explain clearly with snapshot, easy to solve u r issue..


Sina, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response