CMSC 313 Project 1

Number Theory

Assigned Monday, Sept 14, 2009
Program Due 11:59pm Tuesday, Sept 22, 2009
Points
30 points for correctness (6 tests, 5 points each)
10 points for design, coding style
40 points total
Updates  

The Objective

The objective of this assignment is to become familiar with good design practices, writing in C in a Unix environment, and using functions. It may also heighten your appreciation of mathematics.

The Background

The study of mathematics is separated into many fields. The one that tends to lead students to discover the beauty of mathematics is the field of number theory. This field deals with numbers and their relationships to each other.

The field of number theory has lead to discoveries such as :

The Task

This is an individual project. Do your own work. Positive integers can be categorized in many different ways. This project will let you investigate some familiar and some new ways of looking at integers. Your mission is to write a program that examines a positive integer greater than 1 that the user specifies and categorizes it as follows:

  1. ODD or EVEN
  2. PRIME or COMPOSITE -- a prime number is an integer greater than one that is divisible only by itself and one. Any number that is not "prime" is "composite".
  3. PERFECT / ABUNDANT / DEFICIENT --- as described above
  4. SQUARE -- as described above
  5. TRIANGULAR -- as described above

Your program should also verify the user's input. We promise to enter an integer, but we don't promise it will be greater than 1. If an invalid integer is input, print an appropriate message and reprompt the user for new integer.

Your program MUST break the project into functions according to top-down design principles. Each function should perform just one task. Don't forget to use #defines to make your code more readable. Because this is a relatively small project (and your first project) all your code should be placed into one .c file named project1.c.

A makefile is provided for this project. Copy the makefile from Mr. Frey's public directory (/afs/umbc.edu/users/f/r/frey/pub/313/proj1/) to your working directory for this project. It is not necessary to edit the makefile provided you name your file project1.c, but the makefile should be submitted in case you've decided to change it.

If you wish to use functions from the C math library you must #include <math.h> in your .c file. The rules inside the makefile will link the math library with your .o files.

Submitting the Program

To submit your project, type the following at the Unix prompt: make submit

or you can submit your files separately using the submit command. See this page for a description of project submission commands. To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show all files that you submitted in a format similar to the Unix 'ls' command.

submitls cs313 Proj1



Monday, 14-Sep-2009 09:04:42 EDT