1089 Magic Trick
|
06-18-2018, 03:56 AM
(This post was last modified: 06-18-2018 08:36 AM by Gamo.)
Post: #1
|
|||
|
|||
1089 Magic Trick
I'm trying to program the 1089 trick on HP-11C
This should be a good program to practice and learn RPN programing. What it do is users input any three digits number in which numbers cannot contain repeated number like (222, 122, 444, 477, 339, etc.) These repeated numbers are not allowed. Program take three digits numbers, 1. Reverse it 2. Subtracting the reversed number by the original number. 3. Result from steps two make a second reverse 4. Adding the result from its original number. 5. Out put should have 1089 Example: Start with 532. The Reverse is 235, and the difference is 532-235=297. Reversing the difference gives 792, and 297+792=1089 The problem is there are 648 legitimate 3-digits numbers with no repeated digits and 136 of them produce 198 rather than 1089 My program will do any reversed digits and make sure that the top digits is larger than the second digits so that when subtracting the result will not be negative. My reversed result cannot include 0 at the beginning of some specific digits when calculate result is 198 instead of 1089 Example: 132 reversed to 231 then 231-132=099 reverse to 990+099=1089 Program: 1089 Magic Trick Code:
Gamo |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
1089 Magic Trick - Gamo - 06-18-2018 03:56 AM
RE: 1089 Magic Trick - Dieter - 06-18-2018, 08:45 AM
RE: 1089 Magic Trick - Gamo - 06-18-2018, 09:46 AM
RE: 1089 Magic Trick - Dieter - 06-18-2018, 09:50 AM
RE: 1089 Magic Trick - grsbanks - 06-18-2018, 03:17 PM
|
User(s) browsing this thread: 1 Guest(s)