100 REM Converts a/b to a reccuring fraction.
110 REM Assumes a<b. 
120 REM The reccuring clause shall be put into { }.                      
130 LET radix=10         !             
140 DIM q(1 TO 1000)     !
150 DIM r(0 TO 1000)     !             
160 INPUT a,b            ! a<b   
170 LET r(0)=a                                
180 LET k=1              !                                   
190 DO                                        
200    LET q(k)=int(r(k-1)*radix/b)           
210    LET r(k)=mod(r(k-1)*radix,b)           
220    LET j=0                                
230    DO UNTIL j=k-1 OR r(j)=r(k)            
240       LET j=j+1                           
250    LOOP                                   
260    IF r(j)=r(k) THEN EXIT DO              
270    LET k=k+1                              
280 LOOP                                      
290 !                           
300 PRINT ".";                                
310 FOR i=1 TO j                              
320    PRINT q(i);                           
330 NEXT i                                    
340 PRINT "{"; 
350 FOR i=j+1 TO k                            
360    PRINT q(i);                           
370 NEXT i                                    
380 PRINT "}"  
390 END                                       
  
 