Skip to content

Instantly share code, notes, and snippets.

@zrhans
Created November 13, 2017 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zrhans/5e2d8d1fdde8e208db3df18e9f6d1a61 to your computer and use it in GitHub Desktop.
Save zrhans/5e2d8d1fdde8e208db3df18e9f6d1a61 to your computer and use it in GitHub Desktop.
program teste
integer :: fatorial
integer :: a
a = fatorial(5)
print *, a
end program teste
recursive function fatorial(n) result (fac)
integer :: n, fac
if (n == 0) then
fac = 1
else
fac = n * fatorial(n - 1)
endif
end function fatorial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment