Why is PEMDAS important?

P.E.M.D.A.S - Order Of Operation

A Tricky Equation:

Some people are passing this tricky math question around on Facebook. The reason it’s “tricky” is more a matter of format than it is a matter of difficulty.

6 – 1 x 0 + 2 ÷ 2 =?

Now this problem looks innocent enough, right? Actually, it’s not. It has a perception problem. First, let us look at ways that people might try to solve this problem. For those of us who suck at Algebra, we might just take the problem from left to right and come up with 1 like so…

6 – 1 = 55 x 0 = 00 + 2 = 22 ÷ 2 = 1

Please Excuse My Dear Aunt Sally:

The problem with this solution as we learned in that nasty algebra class that we all love to hate, is that we must follow the rule of (PEMDAS) or “Please Excuse My Dear Aunt Sally.” This means that we work out the problem in a specific order (not necessarily left to right).

We start out looking at the “P” part of PEMDAS. This is all things inside of parenthesis ( ) and brackets [ ]. So if you had for instance 6 – (1 x 0 + 2) ÷ 2, then you would work out the 1 x 0 + 2 first, and your final answer would end up being 5. However, since we don’t have any parenthesis (or brackets), we move on to the “E” part of PEMDAS. This is where we solve all exponents. Obviously, we don’t have any exponents in this equation either, so let’s move on to the “M” and the “D” parts which stand for multiply and divide respectively.

Now we’re getting somewhere. Since our next step is to work out all multiplication and division, we do this in order of left to right in case there are more than one multiplication and/or division expressions in the equation. Let’s look at the equation again. 6 – 1 x 0 + 2 ÷ 2 =? The correct order for working out this problem is as follows…

6 – 1 x 0 + 2 ÷ 26 – 0 + 2 ÷ 2

Now we do the “A” (adding) and “S” (subtracting) parts from left to right. That’s all that is left.

6 – 0 + 16 + 1 = 7

The correct answer is 7.

Did I Just Say The “F” Word?

Now, that being said, if you really want to confuse yourself consider the fact that the format of the original equation uses the ÷ symbol to represent the 2 ÷ 2 portion at the end of the equation. If you were to type this into a computer you would not have the luxury of the “÷” symbol unless you realize that you can type in ALT+0247 to get that character. However, that will not produce the result of a mathematical division. When using a computer to perform mathematical operations you would use the slash symbol (/) to represent division. The problem here is that this same slash symbol also represents a fraction. That’s right, I said the dreaded F-word. When you look at it this way, the equation actually becomes an issue of factoring out fractions. Even though it's a whole lot more complicated to work it out as a fraction, the answer still comes out the same, seven. That’s for a whole different article though.

In this scenario we are asked to create a list of all the customers made inactive on a specific date. This should show enough details about the customer to allow contact with the customer, the reason he or she was made...

In all of programming, there are three basic activities that take place. These programming activities are input, process, and output. One of the many useful tools that programmers use to organize and visualize these...