Jump to content

Percentages


Recommended Posts

What i'm tring to do is to do a simple calculate:

and have it round to the nearest cent.

ex:

$325.50 + 10% = ???

I have an input box for the percent. In it the user will typy "10" for 10%

here are the vars.

$total_price = 325.50 ;(or what they enter into the input box)

$markup_percent = 10 ; (or what they enter into the input box)

$makeup_amount = ???

$total_price_after_markup =???

Need a website: http://www.iconixmarketing.com

Link to comment
Share on other sites

$markup_amount=round(100*$total_price/$markup_percent,2)
$total_price_after_markup=$markup_amount + $total_price

Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house.

Link to comment
Share on other sites

The order of multiplying and dividing does not matter at all, try both, you will get the same answer.

Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house.

Link to comment
Share on other sites

  • Developers

The order of multiplying and dividing does not matter at all, try both, you will get the same answer.

true .... but are you sure about the fomula?

shouldn't that be? :

$markup_amount=round($total_price*$markup_percent/100,2)

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Sorry, I mixed up my formula. I divided the total price by decimal percent. You are correct grandmaster JdeB.

@ OP

Sorry for the confusion.

Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...