Re: TIB: whole # to decimal


[Prev][Next][Index][Thread]

Re: TIB: whole # to decimal




In a message dated 4/22/99 4:31:31 PM Pacific Daylight Time, mao_49@mypad.com 
writes:

> 
>  like ...
>  ClCLD
>  -1 -> x
>  Prompt NUM
>  Lbl INCX
>  x+1 -> x
>  if 10^x/num<1
>  Then
>  Goto INCX
>  end
>  if 1<=(10^x/NUM)<=10
>  then
>  Num/10^x -> num
>  end
>  disp num
>  
>  
>  this program works for all numbers except numbers divisble by 10
>  i saw this problem orignally, but i dont know how to fix it
>  if anyone can, please tell me for my own intellectual curiosity, thanks
>  
>  ben
here is a smaller way 

input A
Lbl LOOP
A/10 \->\A
If A>1
Goto LOOP

it the user puts in a decimal like .5 then it outputs .05 to fix this try
 input A
if A<1
return
Lbl LOOP
A/10 \->\A
If A>1 
goto LOOP
 but if the user puts in a negative number the routine returns the number 
entered