# Install fortranmagic with 'pip3 install fortranmagic'
%load_ext fortranmagic
%%fortran
subroutine fib(n, a)
integer, intent(in) :: n
real, intent(out) :: a
integer :: i
real :: b, tmp
a = 0
b = 1
do i = 1, n
tmp = b
b = a
a = a + tmp
end do
end subroutine
for i in range(10):
print(fib(i))
%timeit fib(100)