Posts: 120
Threads: 9
Joined: Aug 2005
Yiannis
I hope this helps. I am only a relative novice with HP49G+ programming. I must admit it seems quite challenging! The program below finds the area and perimeter of a rectangle and then adds them for given inputs H and L.
<<'H' STO 'L' STO
'2*(H+L)' 'P' STO 'H*L' 'A' STO
<<A>> ->NUM
<<P>> ->NUM
<<'A+P'>> ->NUM
>>
I hope this helps in some way. I do apologise but I do not know how to format the program. Can anyone tell me how to format?
Regards
Chris Dean
Posts: 28
Threads: 6
Joined: Dec 2007
Yiannis,
Here's an example for a rectangle.
I tried this, and it works:
<<
-> h l << "area" 'h*l' ->NUM
"perim" '(2*h)+(2*l)' ->NUM >>
>>
Don't worry about carriage returns. Type the program exactly as above, and then press ENTER. Type 'yourprogname' and press STO.
To use it, first enter the two values:
val1 SPC val2 and then press the softkey for 'yourprogname' or just type the name and press EVAL.
For example, for my rectangle, I type 3 SPC 4 ENTER and then press the 'yourprogname' softkey.
it outputs:
"area"
12
"perim"
14
Hope this helps,
EL
Posts: 1,755
Threads: 112
Joined: Jan 2005
Hi, Yiannis:
Yiannis posted:
"say I need a program that when I fill in the dimensions of a parallelogram (i.e its height and length) I get its area, volume and perimeter and then sum of the perimeter and the area. Input h: and l: Output P: A: V: and P+A"
Excuse me but I couldn't resist, my mathematical guts just gave a jump upon reading your 'example'. I know that you intend it as just an example, not an actual need, but certainly it was as bad an example as it gets, namely:
- Giving just height (h) and length (l), there's no way you can compute its volume (V), you need an additional parameter for that, namely the width (w)
- Computing "sum of the perimeter and the area (P+A)" is absolutely nonsensical, their dimensionality is different and there's no way they can be added up meaningfully. It's like asking for the sum of volts and pounds ! :-)
That said, good luck with your 48/49 programming. For the HP-71B you'd simply use something like this:
10 INPUT H,L
20 P=2*H+2*L
30 A=H*L
40 V=A*W
50 PRINT P,A,V,P+A
Best regards from V.