FORTRAN
GFortran
Installation
Ubuntu
apt install gfortran
AlmaLinux
dnf install gcc-gfortran
Arch Linux
pacman -S gcc-fortran
Examples
Fibonacci Numbers
program main
implicit none
character(255) a
integer n
call getarg(1, a)
read(a,*) n
print *, fib(n)
contains
recursive integer function fib(n) result(ret)
integer n
if (n < 2) then
ret = n
else
ret = fib(n-2) + fib(n-1)
end if
end function fib
end program main
! compile example
! gfortran -o fib_fortran -O3 fibonacci.f90