Created
November 13, 2017 00:36
-
-
Save zrhans/5e2d8d1fdde8e208db3df18e9f6d1a61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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