Order of Operations Question! I am vary perplexed right now...I have gone through every possibility I can think of here and I am getting the answer 23. The answer is supposed to be -19 though...question below.
25-(16-9)+7-2
Which furthers my point...
i got 23 O.o
23 is the right answer
23 toooooooooooo.......
Apparently no. Unless they put in the wrong answer...
y do u say the answer is supposed to be 19 O.o
i'm getting......
This is for my programming class. We're going over Order of Operations for programming, but they say the answer is -19 when everyone is getting 23...
haha....
Oh so it is from programming>??
Then the answer will be -19..
unless they want you distribute the - sign before the (16-9) making it -16+9
How so?
Programming has different rules...
as written, it is 23... are you s'posed to read the expression as the input given by the user?
25-(16-9)+7-2 25-16+9+7-2 9+9+7-2 18+7-2 25-2 23 GRRR ITS STILL 23
Ok. I should probably ask this in the computer science section then... @dpaInc Not sure... THis was like a quick evaluation before I move on. I got everything but this one right...
ie, will the user input the expression?
Ummm no? THis is all I was given to work with:
math and computer science CLASH!!!!
lol...I asked it in the math section since it seemed a lot more like math than programming to me...
Is there something I'm missing...?
What does Part 2 say??
It just talks about what modulus is...here is a screenshot:
what language is this? I notice your order of ops does not define exponentiation, nor the effect of parens. but with mult and div having higher precedence than add/subtract there is no way to get negative 19 out of this expression.
Java
Is there no possible way for it to be -19?
I just ran class Main { public static void main (String[] args) throws java.lang.Exception { java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in)); String s; System.out.print(5*5-(4*4-3*3)+14/2-6/3); } } and it printed out 23
Really? I'm going to e-mail my teacher then and see what she says since it seems that it should indeed by 23...
Thanks everyone for verifying for me...
For all of those that worked on this. Apparently the website had a typo...the question was supposedly supposed to be: \[5^2 - (4^2 - 3^2)^2 + 14/2 - 6/3\]
thanks... i was interested to see if i was going crazy or not...:)
Join our real-time social learning platform and learn together with your friends!