Khan Academy: "Writing a Simple Factorial Program", "Stepping through the Factorial Program", and "Flowchart for the Factorial Program"
Watch these lectures. The first lecture uses a for loop to calculate the factorial of a natural number greater than or equal to 0. Remember to focus on the design or algorithm of the program and the semantics of the program statements.
In the second, note how Khan verifies the program by stepping through it. In the previous video, he also ran it several times to check it out.
In the third lecture, Khan documents the design of the factorial program by flowcharting it; this is the design of the program, which logically is done before writing the program.
Last modified: Wednesday, February 10, 2016, 11:00 AM