Created
April 18, 2018 23:35
-
-
Save zrhans/0c69e06fd4ec44c86743a2d3e5e31d37 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
!gfortran, gcc version 5.4.0 20160609 | |
program forca_magnetica | |
real :: B = 1.2 ! [mT] | |
real :: K = 5.3 ! [MeV] | |
real :: m = 1.6726219 * 1e-27 !1e-27 ! [Kg] | |
real :: q = 1.60217662 * 1e-19 ! [C] | |
real :: v = 0.0 | |
! Transforma B [mT] -> [T] | |
B = B * 1e-3 | |
! Transforma K [MeV] -> [J] | |
K = K * 1e6 * 1.60 * 1e-19 | |
! Cálculo da Velocidade | |
v = ( 2.0 * K / m )**0.5 | |
! Cálculo da Força Magnética | |
F = q * v * B | |
! Saída de dados - apresentação dos resultados | |
print *,'**** Sem formatar ****' | |
print *,"v: ",v | |
print *,"F: ",F | |
print*, | |
print *,'**** Com formatação ****' | |
print 100,"Velocidade (V) : ",v, "[m/s]" | |
print 100,"Força magnética (Fb): ",F, "[N]" | |
100 format(a,es15.2,1x,a) | |
end program forca_magnetica |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Resultado após compilar e executar o código: