Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi
i'm having small doubt ...

how to increase the amount by the certain percentage..

for example

the amount between $47,196-$57,947 should be increase by the percentage 2%

and for $57,948-$82,253 should be increase by the percentage 3% .

can any one tell how to write logic to dis...
Posted
Comments
Sergey Alexandrovich Kryukov 29-Oct-11 23:03pm    
Off-topic.
--SA

That is simple math...
C#
double amount = 57.947 - 47.196;
double newAmount = amount * 1.02;
 
Share this answer
 
v2
if "X" is to be increased by "Y%", then the new value of X would be:

X' = (X + ((Y * x)/100)). This should make it clear.
 
Share this answer
 
Comments
Henning Dieterichs 30-Oct-11 7:14am    
assuming x = X = amount and newAmount = X':
newAmount = amount * (1 + (Y / 100)) which is exactly the same I wrote (1 + Y / 100 = 1.02 if Y = 2)
I.explore.code 30-Oct-11 10:17am    
I just tried to make it more explicit for the questioner.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900