<FUNCTION Example Program>
Program function_example
Real :: a=2, b=3, c=4
Real, External :: shiki1,shiki2,shiki3
Print *, shiki1(2.,a,b,c)
Print *, shiki2(2.,a,b,c)
Print *, shiki3(2.,a,b,c)
End Program
Real Function shiki1(x,a,b,c)
Real, Intent(In) :: x,a,b,c
shiki1 = a*x**2 + b*x + c
End Function shiki1
Function shiki2(x,a,b,c) Result( y )
Real y,x,a,b,c
Intent(In) x,a,b,c
y = a*x**2 + b*x + c
End Function
Function shiki3(x,a,b,c)
Real shiki3
Real,Intent(In) :: x,a,b,c
shiki3 = a*x**2 + b*x + c
End
■ Execution Results
18.0000000
18.0000000
18.0000000