Fortran is the "living fossil" of computer programming languages. It was originally developed in the 1950's to run on IBM's 704 computer. Fortran was not the first compiler, but it offered mathematicians, engineers and scientists a language more suited to numeric and scientific computing than others before it. Fortran 77 represents one stage in Fortran's evolution that keeps it a relevant programming language today. Fortran has been available for installation on all versions of Ubuntu since Warty Warthog.
Things You'll Need
- Current release of Ubuntu Linux
- Internet Connection
- Plain Text editor
Press the "Alt" and "F2" keys at the same time. Type "gnome-terminal" in the input box and press "Enter."
Type "sudo apt-get install f2c fort77" at the command prompt. Press enter key. Enter your password and press enter again.
Type "Y" and press "Enter" at the prompt, "Do you want to continue [Y/n]?" Wait for the software installation process to complete.
Load the text editor by typing "gedit" at the terminal command prompt. Press "Enter."
Enter the following sample code in the text editor. Line the columns of text exactly as shown.
text = 'Hello World'
write (*,*) text
Click on the "File" menu and select the "Save" option. Save the file under the name "demo.f"
Click on the "File" menu. Select "Quit" to close the editor.
Type "f77 -o demo demo.f" at the command prompt to compile the Fortran program.
Type "./demo" at the command prompt, then press "Enter" to run the "hello world" demo.
Tips & Warnings
- Well-written code comments can help programmers debug, maintain and document their work. Ubuntu and most other Linux distributions include tools to automatically generate documentation from source code comments. Ubuntu's repository contains Robodoc and the Geany IDE plugin, GeanyGenDoc.
- Fortran was developed during the era when computers were programmed and fed data using 80 column punch cards. Columns have meaning to Fortran compilers. The first column is used for the "c" or "*" symbol indicating comments. Columns one through five are for statement labels. Only columns seven through 72 are used for actual program statements. Misaligned code may not compile at all.
- Photo Credit Jupiterimages/Photos.com/Getty Images
How to Run Fortran F Code on Ubuntu
While most programmers used languages such as C, C++, Java or Python by the dawning of the 21st century, some developers still...
How to Learn Fortran on a Mac
It would be easiest to learn Fortran 77 first since more examples exist for the older version. ... How to Learn FORTRAN;...
How to Convert Fortran to Visual Basic
Fortran was the world's first procedural programming language, ... However, since its release in 1957, many other language have come to the...