How can I use Fortran compiler? [closed]

I'm new to Ubuntu and don't know anything about using the command line.

1

1 Answer

If you have the code below in the text file hello.f90

Program Hello
Print *, "Hello World!"
End Program Hello

To compile the code, start the terminal and type:

gfortran -o hello hello.f90

To run the code, type

./hello

You need to have the compiler installed. If it is not installed type the following in the terminal:

sudo apt-get install gfortran

The hello.f90 file should be created in your home folder, e.g. using

gedit hello.f90&

You Might Also Like