home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
p4_6bs.seq
< prev
next >
Wrap
Text File
|
1990-04-14
|
516b
|
28 lines
\ Balraj Sidhu Set: 14D4
\ Comp 462 - Forth
\ Date: April 12, 1990
\ Problem 4.6
variable semi
: xnew ( n xold -- x xnew )
2dup / + 2/ ;
: sqrt ( n -- root )
dup 0< if abort" Illegal argument" then
dup 1 >
if dup 2/ ( n n/2 )
10 0 do xnew loop nip
then ;
: cal ( -- )
semi @ 3 roll - ;
: area ( a b c -- area )
3dup + + 2/ semi !
cal cal cal
* * semi @ * sqrt
cr ." Triangle area is: " . ;