CMSC 160 -- Lab 4

Lab 4

Getting Started

Log into the computer science server and use wget and tar to download your starter code.
  1. Use wget to download the file at
  2. Uncompress the lab4.tgz file by using tar -xvzf lab4.tgz
  3. Use ls to see that there is a new directory called lab4
  4. Use cd lab4 to change directory to the lab4 directory

Linux Commands

We can create new files and directories but sometimes we need to move or delete our files.
  • rm filename permanently removes (deletes) the file
  • cp oldname newname copies the file at oldname to a new file at newname.
  • mv oldname newname moves the file from oldname to the file newname. Note this does not copy, can overwrite files and removes the original file!
Each of these commands has additional options, you can find out more about linux commands by reading the man pages found using the man program. Try out man cp to see all of the options.

The Problem

Write the code for a program that prompts the user for two integer numbers and prints each number from the smaller number to the larger number. You should also write code to find and print the GCD of the two numbers. In this lab we will:
  1. write test cases
  2. write a README
  3. practice using conditions
Remember, you will be graded on style, syntax, functionality, test cases, and correctness.
An Example README.txt:
Lab3: Three Numbers
Author: Julian Dymacek
Date: 2017 Sept. 5

A program to compute statistics about three decimal numbers.

To compile:

To run:

Test case:
		 3 5
		3 4 5
		GCD is 1


You should start by creating test cases. What are possible tricky conditions that you should test? Next think about what data you will need to store. What kind of information do you need to output?


When you are done you may hand in your lab by using make handin.

The lab is due at 11:59pm Sept. 19th 2017.