How Can I Use Fortran Compiler? [Closed]

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

1

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&
David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest