473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to take off a percentage?

133 100+
Hi,

I have the following values:

49.99
99.99
149.99
199.99

People can enter a coupon code to take away e.g. 10, 20, 30%

How would i take away one of the above percentages away from e.g. 199.99

Cheers,
Adam
Feb 26 '08 #1
4 5989
hsriat
1,654 Expert 1GB
Hi,

I have the following values:

49.99
99.99
149.99
199.99

People can enter a coupon code to take away e.g. 10, 20, 30%

How would i take away one of the above percentages away from e.g. 199.99

Cheers,
Adam
10% of 199.99 = 199.99*(10/100) = 19.999

Are you asking this or something else?
Feb 26 '08 #2
adamjblakey
133 100+
10% of 199.99 = 199.99*(10/100) = 19.999

Are you asking this or something else?

Yes thanks but what i need it to is e.g.

If i do this

$total = 199.99;
$maintotal = $total*(50/100);

Then i get back 75 but what i need back is 74.99

Any ideas?
Feb 26 '08 #3
hsriat
1,654 Expert 1GB
Yes thanks but what i need it to is e.g.

If i do this

$total = 199.99;
$maintotal = $total*(50/100);

Then i get back 75 but what i need back is 74.99

Any ideas?
I think there's something wrong with server that it gives 75 when you process the above said equation.

A function known as round() is used, but to convert 74.99 to 75, not the other way.

You may tell more detail about the problem, then I can help you.
Feb 26 '08 #4
ronverdonk
4,258 Expert 4TB
There is definitely something wrong. The following results 99.995[php]<?php
echo 199.99*(50/100);
//result = 99.995
?>[/php]Ronald
Feb 26 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Conax | last post by:
Hello, This is actually a general programming question but I don't know which newsgroup best to put it so please pardon me. I've always been looking for the best way to get an accurate...
7
by: Rob Meade | last post by:
Hi all, I have a recordset iterating through and dumping out to the screen a series of percentages, using the precision 5 and numericscale 2 etc. When I dump them to the page some of the...
0
by: fake ID | last post by:
Since you can't search for these symbols used in asp.net "<%#" or '<%=' I thought i'd post this to make things a little easier to find. Potential search word combinations: -lessthan Percentage...
5
by: James Conrad StJohn Foreman | last post by:
Have found http://www-128.ibm.com/developerworks/db2/library/techarticle/lyle/0110lyle.html which is quite helpful, but doesn't quite tell me what I want. I have a table, advertising_spend with...
6
by: Hacking Bear | last post by:
Hi, I still don't quite fully understand how to handle mixing border/margin pixel width with percentage width. In the example below, I want to place side-by-side two DIV boxes inside a box....
1
by: Jeff Bender | last post by:
http://people.virginia.edu/~kjl3d/testHeight.html Why doesn't the table with id shouldBeTall have a height that is the same as it's enclosing td? Firebug tells me that the table's height is 25...
4
by: Micheal | last post by:
Greetings Access Group, Being relatively new to Access, I try to work through problems on my own and have been very successful, although I have a conundrum that I have been working on for two days...
8
Nathan H
by: Nathan H | last post by:
I am trying to write a query that will result in showing records that have a large percentage difference among fields in a table. For instance: Table field1.Item field2.account1 (percentage)...
5
by: Aswanth | last post by:
I'm Using Asp.Net with C# & Working with SSRS 2005 for Generating Reports.. The Following Expression I'm using in Reports to Show the Percentage of Particular Items in REPORT.. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.