Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to return a value for a function in TI-89?

This is my function to calculate the gcd of two numbers a and b. When I use Prgm and EndPrgm, it worked fine. However, it kept popping up an error message say "Invalid in a function or current expression" when creating a function :(. Any idea?

gcd(a, b )
Func 
 If a>b Then
  a->t
  b->a
  t->b
 EndIf

 While b#0
  a->t
  b->a
  mod(t, b)->b 
 EndWhile
 Return a
EndFunc
like image 844
Chan Avatar asked Oct 17 '25 15:10

Chan


1 Answers

I got it solved by create a local copy of parameters:

Local x, y  
a->x  
b->y  
like image 157
Chan Avatar answered Oct 22 '25 00:10

Chan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!