Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program loop_passo_real
- implicit none
- real :: n = 0.0
- real :: x1 = 0.0, x2 = 2.0 , dx = 0.2
- integer :: i, iteracoes
- ! f(x) = x^2
- iteracoes = INT ( ( x2 - x1 ) / dx)
- do i = 1, iteracoes
- n = i * dx
- print '(A,f5.2,A,f5.2)', 'f(',n,') = ',n**2.0
- enddo
- end program integral_x_2
- ! Desafio: Faca uma funcao externa para o calculo
- ! Faça uma funcao para a integral da no intervalo (a,b)
- ! passado como argumento.
- ! ====== Resultado exemplo
- ! Compiling the source code....
- ! $gfortran -std=f95 main.f95 -o demo 2>&1
- !
- ! Executing the program....
- ! $demo
- ! f( 0.20) = 0.04
- ! f( 0.40) = 0.16
- ! f( 0.60) = 0.36
- ! f( 0.80) = 0.64
- ! f( 1.00) = 1.00
- ! f( 1.20) = 1.44
- ! f( 1.40) = 1.96
- ! f( 1.60) = 2.56
- ! f( 1.80) = 3.24
- ! f( 2.00) = 4.00
Advertisement
Add Comment
Please, Sign In to add comment