Post Reply 
Clock Hands Challenge
03-08-2019, 03:30 AM (This post was last modified: 03-09-2019 08:38 AM by RMollov.)
Post: #17
RE: Clock Hands Challenge
[quote='xerxes' pid='113402' dateline='1551968341']
A more compact version with Joe's suggestion:

Code:
INPUT H
H=MOD(H,12)
F=12/11
IF H<6 THEN D=-6 ELSE D=6 
PRINT DMS(H*F)
PRINT DMS((H-D)*F+D)

Very elegant! Based on it here is my RPN (HP42S/DM42) take:
Code:

00 { 39-Byte Prgm }
01▶LBL "CLOCK"
02 IP
03 12
04 MOD
05 6
06 X>Y?
07 +/-
08 LASTX
09 11
10 ÷
11 R^
12 RCL× ST Y
13 →HMS
14 R^
15 RCL- ST T
16 RCL× ST Z
17 RCL+ ST T
18 →HMS
19 END

Cheers
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Clock Hands Challenge - RMollov - 03-02-2019, 02:47 AM
RE: Clock Hands Challenge - Dieter - 03-05-2019, 07:17 PM
RE: Clock Hands Challenge - rprosperi - 03-05-2019, 11:29 PM
RE: Clock Hands Challenge - rprosperi - 03-06-2019, 02:43 AM
RE: Clock Hands Challenge - RMollov - 03-06-2019, 07:50 AM
RE: Clock Hands Challenge - ijabbott - 03-06-2019, 05:57 PM
RE: Clock Hands Challenge - Thomas Okken - 03-06-2019, 06:40 PM
RE: Clock Hands Challenge - ijabbott - 03-05-2019, 10:16 PM
RE: Clock Hands Challenge - Thomas Klemm - 03-05-2019, 10:52 PM
RE: Clock Hands Challenge - Thomas Klemm - 03-06-2019, 07:28 PM
RE: Clock Hands Challenge - RMollov - 03-07-2019, 07:21 AM
RE: Clock Hands Challenge - xerxes - 03-06-2019, 10:03 PM
RE: Clock Hands Challenge - Joe Horn - 03-06-2019, 11:55 PM
RE: Clock Hands Challenge - xerxes - 03-07-2019, 02:19 PM
RE: Clock Hands Challenge - RMollov - 03-08-2019 03:30 AM



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