6 - 1 x 0 + 2 ÷ 2 = ?
This is a little tricky math equation you might have seen floating around Facebook or some other social network. At first glance, the problem looks innocent enough. Most people would try to solve this problem simply by working it from left to right. This would incorrectly result in the answer of "1".
Let’s take another look at it from the perspective of the algebraic law of "order of operations", or as I put it in my HubPages article at Why is PEMDAS Important? Please Excuse My Dear Aunt Sally. The basic gist of it is that you solve all equations by evaluating them in this order; Parenthesis, Exponents, Multiplication and Division, and then Addition and Subtraction.
So instead of solving the above equation simply by going left to right, It would be more accurately solved by evaluating the multiplications and divisions first, and then the additions and subtractions like so...
Or, you could just use the one of the functions I built into this web page using three different programming languages (Visual Basic, C-Sharp, and JavaScript). Click on the other tabs above to see the code that is used for various frameworks and programming languages.
6 - 1 x 0 + 2 ÷ 2 = ?
For this tab I used the JavaScript method to generate the answer shown above. However, the formula works the same for all three languages on all frameworks shown. The Visual Basic and C# versions run in Code-Behind on the server side in the old ASP.Net Web application (.Net Framework) so they require an ASP:Label control on the page with the id="lblAnswerFw" and runat="server" to be set.
JavaScript Code:
VisualBasic Code Behid:
C# Code Behind:
6 - 1 x 0 + 2 ÷ 2 = 7
Model:
The .NET Core MVC framework uses a development pattern called MVC which stands for Model, View, Controller. For this example, the Model is a 32-bit Integer object built into the programming language(s). The Visual Basic and C# versions run in code on the server side of the .NET Core Framework which then passes the model from the server to the view, typically via the controller.