# % problem

• Mar 5th 2006, 12:37 AM
mohawk523
% problem
Hi all
I hope someone may be able to help me as it includes a problem in programming so i may not be in the right place if not then sorry.

I want to - 75% from a number

eg Price = Price - 75%

With Price = 7 i get -68 when it should be 1.75.

Im sure this has something to do with the way i write the code and wondered if anyone has any idea how to do this in any programing language.

As i say i might be in wrong place but worth a try.

Thanks to all :)
• Mar 5th 2006, 12:46 AM
CaptainBlack
Quote:

Originally Posted by mohawk523
Hi all
I hope someone may be able to help me as it includes a problem in programming so i may not be in the right place if not then sorry.

I want to - 75% from a number

eg Price = Price - 75%

With Price = 7 i get -68 when it should be 1.75.

Im sure this has something to do with the way i write the code and wondered if anyone has any idea how to do this in any programing language.

As i say i might be in wrong place but worth a try.

Thanks to all :)

75% means 75/100 or 0.75.
75% of a number N, is 0.75N

So if you take 75% form N you are left with N-0.75N=0.25N.

Your code should look something like:

price=0.25*price;

RonL
• Mar 5th 2006, 03:19 AM
mohawk523
%%%%????
Thanks il work with that :)