diff options
Diffstat (limited to 'src/examples/function.ft')
-rw-r--r-- | src/examples/function.ft | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/examples/function.ft b/src/examples/function.ft new file mode 100644 index 0000000..2c6ed7d --- /dev/null +++ b/src/examples/function.ft @@ -0,0 +1,18 @@ +program example +real::a +real::root +a=30 +root=sqrt(a) +print*,"The square root of ",a," is ",root +end program example + +!Function to calculate the square root of a value +function real sqrt(real value) +real::result +result=1 +int::count +do count=0,10 +result =(result+value/result)/2 +end do +return result +end
\ No newline at end of file |