{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Assignment 2 - CSC180 Assignment 2 Fall 2006 Due Monday...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC180 Assignment 2 Fall 2006 Due: Monday, October 16 by 10:00am Instructions: There are 4 problems in this assignment. You need to write a C program for each problem. Specific instructions regarding which programs your are to submit test plans for are included in the problem statements. Each of your C programs must go in a separate file. Because we will be compiling and running your tests with automatic scripts, it’s very important that your files are named in a very specific way: the file for problem 1 should be named a2p1.c , the file for problem 2 should be named a2p2.c , and so on. All letters in the filenames must be lower-case. All of your test plans must go in a single text file (plain text – not a word processor file) which must be named a2testplan.txt . This document does not need to be a fancy report, however it does need to be clear. Each test plan should be clearly labeled by problem number, and you should also make it easy to tell where one ends and the next begins in the document. Make sure to include your name, student number, and the assignment number at the top of the file. Both your source code files and your test plan file will be submitted electronically. Your programs must accept input data in the order and format specified in each problem statement, and your programs must terminate as indicated in the problem statement. These rules allow us to test all programs with the same input data and return your work in a timely manner. If you have any questions about format or termination, please ask rather than assume. You are not permitted to use arrays in this assignment, and you’re still not to use library functions other than scanf and printf . If your solution code uses them, it will not earn full marks no matter how well it works. Marking: This assignment is out of 50. There are three things we award marks for: Correctness: 32 marks Test plans: 8 marks Style: 10 marks The correctness marks are earned by producing correct results on our tests. Your programs must compile and run correctly on the ECF system to earn full correctness points. The style marks are earned by writing your programs with good style. See the style guidelines posted on ccnet. (As the term progresses, we may add guidelines as they become relevant.) The test plan marks are earned by submitting thorough and readable test plans.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Problems: 1. The greatest common divisor of two integers a and b – written as gcd(a,b) – is the largest positive integer that divides both numbers evenly. For example, gcd(12,18) = 6 . and gcd(0,5) = 5 . (At least one of the operands must be non-zero for the concept of greatest common divisor to make sense.) There are a few ways to go about calculating the greatest common divisor. The most straightforward, and also perhaps the most tedious, way is to determine the prime factorization of both numbers and compare which ones they have in common.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}