home *** CD-ROM | disk | FTP | other *** search
-
- \ Compute area of a circle to three decimal places.
- : CIRCLE_AREA ( r -- )
- DUP * 355 * 113 /MOD
- ." Area = " 5 .R \ ( 8 EMIT ) 1 BACKSPACES
- ASCII . EMIT
- 5 0 DO
- 10 * 113 /MOD 1 .R \ ( 8 EMIT ) 1 BACKSPACES
- LOOP DROP ;
-
- : TEST_CIRC ( -- )
- 11 1 DO CR I CIRCLE_AREA LOOP ;
-
-
-