Two indispensable formulas for percentages
Created:15 Jul 2020 11:21:05
In this article I look at two very useful mathematical formulas related to dealing with percentages efficiently.
You might know them, but it is likely, you haven't not been shown at least one of them while studying the subject during your school years. I remember my own struggles with percentages, a lot of them due to not knowing these formulas in the form I'm presenting in this article.
Percentages formula 1
y = ( x / 100 ) * z
This formula tells you that y is x% of z, where x, y and z are numbers.
Here is an example how to use it:
Example: Suppose, that you have a file with 1084 lines of code and comments in it. Somebody who created the file told you that 25% of the lines are comments. You want to know the exact number of lines which contain comments.
z = 1084
x = 25
y = ?
y = (25 / 100) * 1084 = 271
So, 25% of 1084 is 271, which is the number of comments in the file.
Percentages formula 2
y = ( 1 + x / 100 ) * z
This formula tells you, that y is x% larger than z, where x, y and z are numbers.
Example: Suppose, that your friend has just told you that his website log file's size month-on-month growth is on average 7% and that log file size for the last month was 124MB. You want to know what in terms of the file size your friend might expect at the end of this month.
x = 7
z = 124
y = ?
y = (1 + 7 / 100) * 124 = 132.68MB
So the total log file size for this month is likely to be 132.68MB.
Both formulas given in this articles are incredibly useful when dealing with all sorts of percentages related questions. They are easy in themselves, so also easy to transform and turn into functions written in a programming language.
I hope you have found this article interesting. If you have something to add, you are welcome to leave a comment below.
This post was updated on
15 Jul 2020 11:30:24
Author, Copyright and citation
©Copyright, 2020 Sylwester Wojnowski. This article may not be reproduced
or published as a whole or in parts without permission from the author.
If you share it, please give author credit
and do not remove embedded links.
Computer code, if present in the article, is excluded from the above and licensed under GPLv3.
Cite this article as:
Wojnowski, Sylwester. "Two indispensable formulas for percentages." From sWWW - Code For The Web . https://wojnowski.net.pl//main/index/two-indispensable-formulas-for-percentages