Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment