Fortran is the "living fossil" of computer programming languages. It was originally developed in the 1950s 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.
- Skill level:
- Moderately Challenging
Other People Are Reading
Things you 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 fort 77" 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.
program hello_world implicit none
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 and 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.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for