The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Store and reuse intermediate variable
12-05-2022, 09:10 AM
Post: #1
Store and reuse intermediate variable
Hi all.
One year ago I wrote a post related to subroutine, I'm here again becasue I had a turbulent year.
Some years ago I bought a HP 50g and I'm trying to program it with litte improvement ...

My problem is using local variable in a program, in detail store an intermediate value and reuse it.
To have practice I wrote a simple program that calculate mortgage installment (even if there are financial tools that alreade did it).
I would calculate the installment and the total amount paid (simply multiplying this intermediate value for number of years and months). My problem is store this value.
A sample of program is:
Code:

<<<<"Ins C t A " {
":C:
:t:
:A:" {1 0} V} INPUT OBJ-> -> C t A 
<<'C* (t/100/n)/(1-(1+t/100/n)^(-n*A))' -> R  ;I need to store this value in a local variale R and print on display
'R*A*12' ->NUM "M" ->TAG>> 
>>
Written in this way I can calcultate total amount (tagged with M) and result is correct, but intermediare R variable is not printed.

I red and checked tons of manuals but in didn't find some example that help me.
Thanks in advance.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Store and reuse intermediate variable - oierpa - 12-05-2022 09:10 AM



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