Math Problem
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
I was always under the belief that multiplication and division were on the same level in the order of operations, so you do them in the order they appear.
-
Microsoft's C++ compiler agrees with you.
One of these days I'm going to think of a really clever signature.
yes yes yes ;) ;) ;)
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
9
The difficult we do right away... ...the impossible takes slightly longer.
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
I guess you have to be specific in you input, but I assume that this is what actuall happens: the compiler would see 6/2, no problem that is 3, then It sees a (), and thinks do the stuff inside, witch is 3, then multiply 3*3 = 9 If you wrote this: 6/(2*(2+1)) the story would be different.... My conclution came from here[^]. I know, shamless self promotion :-\
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
I think you're mixing notation styles and the result is ambiguous. Are you showing us a computer expression or an algebra problem? If it's a computer expression, I would tend to think you really mean this: 6/2*(1+2) And in that case the answer is 9. If you're trying to use more customary mathematical notation, then I think you really mean this: 6 -------- 2 (1+2) And in this second case, the answer is 1. That big division bar I'm trying to draw above overrides PEDMAS (a.k.a "My Dear Aunt Sally"). The forward slash generally is not interpreted as being a big division bar... but in light of the confused-looking expression you presented, I wonder if that's what was meant.
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
-
Did you type in "the Meaning of life"? :-D
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
-
I think you're mixing notation styles and the result is ambiguous. Are you showing us a computer expression or an algebra problem? If it's a computer expression, I would tend to think you really mean this: 6/2*(1+2) And in that case the answer is 9. If you're trying to use more customary mathematical notation, then I think you really mean this: 6 -------- 2 (1+2) And in this second case, the answer is 1. That big division bar I'm trying to draw above overrides PEDMAS (a.k.a "My Dear Aunt Sally"). The forward slash generally is not interpreted as being a big division bar... but in light of the confused-looking expression you presented, I wonder if that's what was meant.
In customary mathematical notation the multiplication sign is assumed and would be written out as 6/2*(1+2). Which will evaluate to 9. It can only be properly interpreted as another value if it is written as 6/(2*(1+2)) or equivently 6 -------- 2 * (1+2) A C, C++, C#, Java, etc. compiler will also evaluate this as 9.
Just because the code works, it doesn't mean that it is good code.
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
You are right 9, mult. and div. take precedence.
VS2010/Atmel Studio 6.0 ToDo Manager Extension
Version 3.0 now available. There is no place like 127.0.0.1 -
In customary mathematical notation the multiplication sign is assumed and would be written out as 6/2*(1+2). Which will evaluate to 9. It can only be properly interpreted as another value if it is written as 6/(2*(1+2)) or equivently 6 -------- 2 * (1+2) A C, C++, C#, Java, etc. compiler will also evaluate this as 9.
Just because the code works, it doesn't mean that it is good code.
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
You might want to explain to him about BODMAS.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
Please Excuse My Dear Aunt Sally = PEMDAS = Parentheses, Exponents, (Multiply or Divide), (Add or Subtract) = PE(M|D)(A|S) Your friend is either thinking that parens are an operation or that all multiplies occur before divides. Placing a number next to parens creates an implicit multiplication. So, your equation becomes:
6 / 2 * (1 + 2)
And multiplications and divisions are of equal precedence, so they occur left to right in the order they appear. First, parens:
6 / 2 * 3
Next, all multiplications and divisions in order:
3 * 3
9It is not true that all multiplications occur before all divisions. The answer is 9.
-
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
It looks like you got a good reaction to this question and since there are already several answers, I will not go into that. I think the really important question is, what are you intending to do? If you are coding this (obviously using variables, function calls or other goodies), do you want the "9 result" or the "1 result"? When coding something like this, I prefer to put in additional parenthesis even when they are not needed due to the precedence of operators. I feel that separating the terms like that is the best way to avoid confusion when other developers have to work on the code.
(6/2)*(1+2)
(or6/(2*(1+2))
if that is your intention) might look like it is written by a noob, but everyone understands the meaning and can agree on the result. Adding spaces before and after the operators also helps the readability. Soren Madsen -
hey guys... :-D :-D :-D We have a slight debate about this... 6/2(1+2) so whats the answer.. My answer is 9
6/2=3 1+2=3 3*3=9
My friends answer is 1 He did this(his saying he follow this PEMDAS)6/2(1+2) = 6/2*3 = 6/6
<<==== this is what he write/do answer1
//No animal was harmed during execution of this program.
static void Main(string[] args)
{
int result = 6 / 2 * (1 + 2);
Console.WriteLine("Math Problem 6 / 2 * (1 + 2) = {0}", result); // Answer = 9
Console.ReadKey();}
Edit : The Answer can be 6 as well.. ( If you are doing yoga or you are a spiderman and looking at the screen upside down ) :)
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
-
I was always under the belief that multiplication and division were on the same level in the order of operations, so you do them in the order they appear.