1 / 7

Programming the same task On an HP-41, HP-71B, HP 50g, and HP Prime

Programming the same task On an HP-41, HP-71B, HP 50g, and HP Prime. Goal: Create a program called PCH which inputs two numbers ( A and B ) and returns %Change(A,B) and %Change(B,A) showing the positive one first (or on the bottom of the stack). Example: Input 4 and 5. Return 25 and -20,

temira
Télécharger la présentation

Programming the same task On an HP-41, HP-71B, HP 50g, and HP Prime

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming the same task On an HP-41, HP-71B, HP 50g, and HP Prime

  2. Goal:Create a program called PCH whichinputs two numbers (A and B)and returns%Change(A,B)and%Change(B,A)showing the positive one first(or on the bottom of the stack).

  3. Example: Input 4 and 5. Return 25 and -20, because going from 4 to 5 is +25% change, and going from 5 to 4 is -20% change.

  4. HP-41 [GTO] [.] [.] [PRGM] LBL “PCH” X>Y? X<>Y %CH X<>Y LASTX X<>Y %CH X<>Y RDN END [PRGM] 4 [ENTER] 5 [XEQ] “PCH” (or [R/S])

  5. HP-71B EDIT PCH 10 INPUT “A, B? ”;A,B 20 IF A<B THEN VARSWAP A,B 30 DISP 100*(A-B)/A; 40 DISP 100*(B-A)/B 50 END RUN PCH (or just [RUN]) 4,5 [ENTER]

  6. HP 50g « MAX LASTARG MIN %CH LASTARG SWAP %CH » ‘PCH’ STO 4 [ENTER] 5 PCH (or use VAR menu)

  7. HP Prime [Shift] [Program] [New] PCH EXPORT PCH(A,B) BEGIN LOCAL T; T:=MAX(A,B); A:=MIN(A,B); B:=T; RETURN { %CHANGE(A,B), %CHANGE(B,A) }; END; [Home] PCH(4,5) (or use Vars menu)

More Related