A9 — Early programming languages

Create a Fortran program.

Due Oct 28, 2026

Estimated time to complete (just the assignment, excluding the prep materials): 40–60 minutes.

Prep materials: Week 9: History of computing continued

What to do

Submit your work to Assignment 9 on Brightspace, along with a few quiz questions in there.

Part 1: Getting started with Fortran

FORTRAN’s name is short for Formula Translation. It is one of the oldest high-level programming languages, and it was designed primarily for scientists to write formulas similar to how they write them on paper. The compiler turns those formulas into machine code.

  1. Go to LFortran in the browser.

  2. Replace the example program by the following code:

    program hello
        print *, 'Hello from 1957!'
    end program hello

    Here, print * instruction means “print whatever follows the comma, using the default format”.

  3. Press the Run button and copy the entire output (including the Hello from 1957! line) into your assignment submission.

Part 2: Fahrenheit to Celsius conversion

This program converts temperature stored in f from Fahrenheit to Celsius using the formula \[(f − 32) × 5/9,\] stores the result in c, and prints the conversion information to the screen:

program convert
    real :: f, c
    ! Convert temperature from Fahrenheit to Celsius
    f = 50.0
    c = (f - 32.0) * 5.0 / 9.0
    print *, f, 'degrees F is', c, 'degrees C'
end program convert
  • real :: f, c creates two variables that hold numbers with a decimal point; you can think of variable names as labels for memory cells.
  • ! starts a comment, which the compiler ignores.
  • c = ... evaluates the formula on the right side, then stores the result in the variable c.

Do the following:

  1. Run the program and copy the entire output into your assignment submission.

  2. Change the value of f to 100.4 and run the program again. What is the new value of c? What is the printed value of f? What might be happening here? Write down your observations and thoughts.

  3. At the end of the program (after print but before end program), add lines that convert c to Fahrenheit using the formula \(c × 9/5 + 32\), then print the result. What do you observe? Write it down.

  4. Experiment with multiple different values of f, including 2.1. What do you observe about the output? What might be happening here? Write down your observations and thoughts.

  5. Copy your final program and the final output to your assignment submission.

Grading

Graded for correctness of the program and completion of observations.