Last active
May 15, 2017 23:03
-
-
Save zrhans/c024860d5ccf7b8b6113bf1dbdb8914d to your computer and use it in GitHub Desktop.
Códigos do portalfisica
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 chama_func | |
implicit none | |
real :: a | |
real :: area_do_circulo !!! IMPORTANTE declarar o tipo função quando externa | |
a = area_do_circulo(2.0) | |
print *, "A área do circulo com raio 2.0 é " | |
print *, a | |
end program chama_func | |
! Esta função calcula a área de um círculo de raio r | |
function area_do_circulo(r) | |
implicit none | |
! argumentos fictícios | |
real :: area_do_circulo | |
! variaveis locais | |
real :: r | |
real :: pi | |
pi = 4 * atan (1.0) | |
! resultado da função | |
area_do_circulo = pi * r**2 | |
end function area_do_circulo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment