CSC 171 - Introduction to Computer Programming

Lab Assignment #6 - Counting Loops

Due Wednesday, September 20, 2023

We can specify a counting loop in a flow chart using a binary decision:

The box above the decision has the initial value.

The decision symbol determines that the counting variable is less than or equal to the upper limit.

The box at the end of the loop increments (adds to ) the counting variable. This will usually be 1, but it could be higher.

Create a Python program that will allow the user to enter a value n.

The program will then print values 1 through n, each on a separate line followed by their square.

For example, if the user enters 3, it will print
1         1
2         4
3         9

You will submit a flowchart, pseudocode as well as the Python program.

[Back to the Lab Assignment List]