UMBC CS 104
UMBC CMSC 104 CSEE | 104 | current 104

CMSC 104, Spring 2003

Project 4 - Manipulating Two Integers

Due Date:

Midnight, Thursday April 3

Note: No late projects will be accepted.

Point Value:

This assignment is worth 60 points.

Objectives:

Assignment:

Write a program that prompts the user for two integers and determines each of the following:

Sample output for the program is given in Part 2 below.

Part 1 - The Pseudocode (20 points)

First, write the pseudocode to solve the problem. Be sure that your pseudocode includes the greeting, user prompts, and output labels shown in the sample runs below. Type the pseudocode in to a file called p4pseudo.txt.

Part 2 - The C Code (40 points)

Next, write the corresponding C program. Call it proj4.c. Use the integer data type (int) for all variables.

The output from your program should look EXACTLY like the bolded text in the sample runs given below. Also make sure that the spacing of the output (i.e., blank lines and blanks spaces) is EXACTLY like the spacing in the sample runs. Here is the first sample run:

Manipulating Two Integers

Enter the first integer: 2
Enter the second integer: -5

The first number is greater than the second
The sum is: -3
The product is: -10
The first number is even
The second number is odd

Here is a second run where the two numbers are equal:

Manipulating Two Integers

Enter the first integer: 18
Enter the second integer: 18

The two numbers are equal
The sum is: 36
The product is: 324
The first number is even
The second number is even

Make sure to test your program by running it several times with different values for the integers. Don't forget to test using negative numbers and zero!

Compile your program as follows:

gcc -ansi -Wall proj4.c

Coding Standards:

Note that you MUST adhere to the coding standards and indentation styles given on the Projects home page. So read them carefully and immediately!

Project Submission:

Submit your project by e-mailing your pseudocode (p4pseudo.txt) and source code (proj4.c) to Gaurav (jolly1@umbc.edu) as attachments. Make the Subject of the e-mail Project 4 so that Gaurav knows what it is. Do NOT send your executable file (a.out).


Last Modified: Tuesday, 18-Mar-2003 11:14:16 EST

Tuesday, 18-Mar-2003 11:14:16 EST