›››››; ************************************›; * *›; * 200 Digit Division *›; * *›; * OR *›; * * ›; * "How to use real #'s in ACTION!" *›; * *›; * *›; * by Anupam Razdan *›; * *›; ************************************›››››››MODULE ›› INT ARRAY answer(200) ;(200) <- # of digits in number› › BYTE again ›› INT ctr,› num,› denom,› repeat ››››PROC enterdata()››BYTE zero›› DO› zero ='T ;poor excuse for a Boolean variable› Put($7D)› Print("Please input the numerator of the fraction. ")› num =InputI()› Print("Please input the denominator of the fraction. ")› denom =InputI()› › IF denom =0› THEN› PrintE(" *** ERROR ***")› PrintE("Zeros are invalid in the denominator. ")› zero ='F› FI›› PutE()› UNTIL zero ='T› OD››RETURN ››››PROC calc()››INT ARRAY rem(200) ;(200) <-- # of digits in number››INT loop ›BYTE equal›› ctr =-1› equal ='F›› DO› ctr ==+1› answer(ctr) =num /denom ;simulates long division› rem(ctr) =num MOD denom› num =rem(ctr)*10› repeat =ctr› › IF rem(ctr) =0› THEN equal ='T› ELSE› FOR loop =0 TO (ctr-1)› DO› IF rem(ctr) =rem(loop) ;checks to see if the remainders are repeating › THEN ;(Easiest way to detect a repeating decimal-TRY IT!)› equal ='T› repeat =loop› FI› OD› FI› UNTIL equal ='T› OD › ›RETURN››››PROC outputdata()››BYTE loop›› PrintI(answer(0))› Print(".")› › FOR loop =1 TO repeat DO› PrintI(answer(loop)) OD› › IF repeat <>ctr › THEN› Print("(")› FOR loop =(repeat+1) TO ctr DO› PrintI(answer(loop)) OD› PrintE(")")› FI›› PutE()› PrintE("The numbers in the parenthesis are repeating. ")› PutE()› ›RETURN››››PROC main()›› DO› enterdata()› calc()› outputdata()› › Print("Do you wish to continue ? (RETURN to exit) ")› Close(1) › Open(1,"K:",4,0)› again =GetD(1)› PutE()› IF again ='y› THEN again ='Y FI› UNTIL again <> 'Y› OD› Close(1)››RETURN ››;This program will show you how to ›;use decimals in ACTION!: simply›;use an array to hold the individual›;digits. Now try to simulate decimal›;multiplication!›AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA