home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p4_21dc.seq < prev    next >
Text File  |  1990-04-16  |  396b  |  16 lines

  1. \ Problem 4.21   04/16/90 16:07:08.17
  2.  
  3. \ Compute area of a circle to three decimal places.
  4. : CIRCLE_AREA ( r -- )
  5.         DUP * 355 113 */MOD
  6.         ." Area = " 5 .R        \ ( 8 EMIT ) 1 BACKSPACES
  7.         ASCII . EMIT
  8.         5 0  DO
  9.              10 * 113 /MOD 1 .R \ ( 8 EMIT ) 1 BACKSPACES
  10.              LOOP DROP ;
  11.  
  12. : TEST_CIRC ( -- )
  13.        11 1 DO CR I CIRCLE_AREA LOOP ;
  14.  
  15.  
  16.