# ECE 209 Assignment 4

## Due date

This assignment must be submitted as a C single file for Assignment 4 of the ECE 209.602 section on UNCA moodle by 11:45 PM on Sunday, 25 October.

Your program should be written in standard ANSI C.

## The Objective

This assignment give more practice with loops (particulary nested loops), arithmetic (particular division), arrays, and command line arguments.

Last week my daughter brought home an arithmetic assignment that read "If you count by this number, you will say 300, but you will not say 75." She was supposed to list those numbers where, if you started counting by them, you'd reach 300, but skip 75. 50 is an example of such a number, because you could count: 50, 100, 150, 200, 250, 300. The answer to her problem would have been a list of the 12 numbers: 2, 4, 6, 10, 12, 20, 30, 50, 60, 100, 150, 300.

I want your program to solve the problem, but do a bit more. First, your program must read the numbers as command line arguments. In this example the two input numbers would be "entered" by running your program as follows:

```./assign4 300 75
```

Your program should allow the "user" to enter the number in any order, but it should check that (1) there are exactly two distinct arguments, (2) both of the arguments are valid positive integers, (3) the smaller number divides into the larger one, and (4) the larger number is less than 1000000. Because of these rules, all of the following should result in an error message.

```./assign4 0     300
./assign4 -15   300
./assign4 8     300
./assign4 300   300
./assign4 2  6  300
./assign4 ten   300
./assign4 75.0  300
./assign4 75x   300
./assign4 " 75" 300
./assign4 "75 " 300
./assign4 1000  1000000
```

If all you did was just list all the numbers, this would be too easy because it wouldn't require a nested loop. So I'm also going to require you to do the counting in neatly formatted columns. Here's an example of what your program should do:

```./assign4  5  30
2     3     6   10    15    30
4     6    12   20    30
6     9    18   30
8    12    24
10    15    30
12    18
14    21
16    24
18    27
20    30
22
24
26
28
30
```

## Setting the command line arguments

You probably don't want to have to start up a command line to test your program; particularly, on a Windows computer where'd you have to use a Cygwin command line interpreter. So, here's what you do to set command line arguments under NetBeans.

First go through the mouse selections to bring up the menu.

In the panel on the left select . In the panel on the right, you will see a row labeled for entering arguments for the `main` function.

Enter your arguments in the cell and then press the button.

Your new arguments will be used the next time you run your program.