21.06.2013 Views

Introducción a FORTRAN

Introducción a FORTRAN

Introducción a FORTRAN

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

x = real(i)<br />

y = real(j)<br />

! Calcular distancia al origen llamado a funcion "radio".<br />

r = radio(x,y)<br />

! Escribir a archivo.<br />

end do<br />

end do<br />

write(10,’(3f10.3)’) x,y,r<br />

! Cerrar archivo.<br />

close(10)<br />

end program distancia<br />

! Funcion "radio".<br />

function radio(x,y)<br />

! Declarar variables.<br />

implicit none<br />

real radio,x,y<br />

! Calcular distancia al origen.<br />

radio = sqrt(x**2 + y**2)<br />

! Terminar funcion.<br />

29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!