Post Reply 
silly math puzzle
10-21-2019, 01:09 PM
Post: #3
RE: silly math puzzle
(10-21-2019 08:51 AM)Wes Loewer Wrote:  Today is a national holiday which means that I have too much time on my hands, which led to this silly little math puzzle.

You have probably seen the 8/2(2+2) thing that was going around the internet a couple of months ago. The big argument was whether the answer was 1 or 16. Casios give 1, TI's gives 16. How about the Prime? Since PPL doesn't allow implied multiplication, I had to put in explicit multiplication. Look at the RETURN line and predict what you think the output will be.

Code:
#pragma mode( separator(/+;) integer(h64) )

EXPORT PUZZLE()
BEGIN
 RETURN 8/2*(2+2);
END;

Now run the program and see if you were right. ;-)

Happy Mashujaa Day!

Using PMDAS, the answer is 16 which is what you'd get if doing it by hand or with an algebraic machine. With RPN, you have to know the rules to do it properly.

8/2*(2+2)
Parentheses first
8/2*4
Division next since multiplication and division are done in order from left to right
4*4
Multiplication next
16

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
silly math puzzle - Wes Loewer - 10-21-2019, 08:51 AM
RE: silly math puzzle - John Keith - 10-21-2019, 11:34 AM
RE: silly math puzzle - toml_12953 - 10-21-2019 01:09 PM
RE: silly math puzzle - StephenG1CMZ - 10-21-2019, 01:53 PM
RE: silly math puzzle - toml_12953 - 10-21-2019, 02:38 PM
RE: silly math puzzle - StephenG1CMZ - 10-21-2019, 03:02 PM
RE: silly math puzzle - Wes Loewer - 10-21-2019, 02:41 PM
RE: silly math puzzle - toml_12953 - 10-21-2019, 03:08 PM
RE: silly math puzzle - grsbanks - 10-21-2019, 03:07 PM
RE: silly math puzzle - Wes Loewer - 10-21-2019, 03:21 PM
RE: silly math puzzle - toml_12953 - 10-21-2019, 05:51 PM



User(s) browsing this thread: 1 Guest(s)