Gfortran
- how to run fortran code in linux
- how to run a fortran 77 program in linux
- how to run fortran code in terminal
- how to run fortran code in ubuntu
How to run a fortran program in ubuntu terminal
How to compile fortran code in linux...
Fortran Hello World Example: How To Write and Execute Fortran Program on Linux OS
Question: I would like to understand the basics of how to write and execute a Fortran program on Linux OS.
Can you explain it with a simple example?
Answer: In this article, let us review very quickly how to write a basic Hello World Fortran program and execute *.f program on Linux or Unix OS.
1. Write a Hello World Fortran Program
Create helloworld.f program using the Vim editor as shown below.
$ vim helloworld.f program hello print *,"Hello World!" end program helloYou can also write a shorter version of the hello world Fortran program as shown below.
$ vim helloworld.f PRINT *,"Hello World!" END2.
Make sure Fortran compiler is installed on your system
Make sure Fortran compiler is installed on your system as shown below.
$ whereis gfortran gfortran: /usr/bin/gfortran /usr/share/man/man1/gfortran.1.gz $ which gfortran /usr/bin/gfortran $ dpkg -l | grep gfortran ii gfortran 4:4.3.3-1ubuntu1 The GNU Fortran 95 compiler ii gfortran-4.3 4.3.3-5ubuntu4 The GNU Fortran 95 compiler ii- how to run fortran code
- how to run fortran in linux