Programming Assignment 1 Solution




  1. Introduction to MASM assembly language

  2. Defining variables (integer and string)

  3. Using library procedures for I/O

  4. Integer arithmetic

  1. Display your name and program title on the output screen.

  1. Display instructions for the user.

  2. Prompt the user to enter two numbers.

  3. Calculate the sum, difference, product, (integer) quotient and remainder of the numbers.

  4. Display a terminating message.

  1. The main procedure must be divided into sections: introduction

get the data

calculate the required values display the results

say goodbye

  1. The results of calculations must be stored in named variables before being displayed.

  2. The program must be fully documented. This includes a complete header block for identification, description, etc., and a comment outline to explain each section of code.

  3. Submit your text code file (.asm) to Canvas by the due date.

  1. A program shell (template) is available on the course website.

  1. You are not required to handle negative input or negative results.

  2. You may submit only one of your programs up to 48 hours late without penalty. Try not to use this on the first program. A second late submission will not be accepted.

  3. To create, assemble, run, debug, and modify your program, follow the instructions at

(Or other version for different version of Visual Studio)

  1. Find the assembly language instruction syntax in the textbook.

  2. Find help on using Irvine library procedures in in the textbook.

Example execution (user input is in italics):

Elementary Arithmetic by Wile E. Coyote

Enter 2 numbers, and I’ll show you the sum, difference, product, quotient, and remainder.

First number: 37

Second number: 5



37 x 5 = 185

37 ÷ 5 = 7 remainder 2

Impressed? Bye!

Extra-credit options (original definition must be fulfilled):

  1. Repeat until the user chooses to quit.

  2. Validate the second number to be less than the first.

  3. Calculate and display the quotient as a floating-point number, rounded to the nearest .001.

To ensure you receive credit for any extra credit options you did, you must add one print statement to your program output PER EXTRA CREDIT which describes the extra credit you chose to work on. You will not receive extra credit points unless you do this. The statement must be formatted as follows…

–Program Intro–


–Program prompts, etc—

For example, for extra credit option #2:

Elementary Arithmetic by Wile E. Coyote

**EC: Program verifies second number less than first.

Enter 2 numbers, and I’ll show you the sum, difference, product, quotient, and remainder.

First number: 7

Second number: 9

The second number must be less than the first!

Impressed? Bye!