For this assignment, you will write a C program called nums.c.
This program reads two numbers from the user,
and produces a few debatably-interesting facts about the numbers.
See the example output for the exact output expected from your program.
Here’s an outline for the program:
Here are a few example runs of the program. Underlined text is typed by
the user, the “%” is the command prompt, the rest is from the program.
(You don’t have to make it underlined—that’s just how it looks here,
so you can tell who does what.)
Don’t be creative about your output—it must look exactly like this
(except for the leading spaces):
% c99 nums.c
% ./a.out
Firstly: 20
Secondly: 1957
Your numbers are 20 and 1957
20 divided by 1957 makes 0.010220
Difference: 1937
Neither is divisible by six.
% ./a.out
Firstly: 17
Secondly: 12
Your numbers are 17 and 12
17 divided by 12 makes 1.416667
Difference: 5
17 isn't divisible by six, but 12 is.
% ./a.out
Firstly: 18
Secondly: -3
Your numbers are 18 and -3
18 divided by -3 makes -6.000000
Difference: 21
18 is divisible by six, however, -3 isn't.
% ./a.out
Firstly: 60
Secondly: 0
Your numbers are 60 and 0
60 divided by zero makes a problem.
Difference: 60
Both are divisible by six.
% ./a.out
Firstly: 13
Secondly: 9
Bad luck!
%
.c file; not the binary,
not the executable, not the a.out.
nums.c
int variables, declared in main,
in your entire program.
No other variables, of any type, are allowed.
“You’re not serious about only two variables, are you?”
“I'm serious.”
“That can’t be done!”
“Can too.”
“Surely, you don’t mean exactly the same output. Close is good enough, right?”
“No, I mean super-duper-mega-totally-exactly the same.”
“Well, you don’t care about upper/lower case, right?”
“I do care.”
“You can’t take off points for spelling!”
“Sure, I can. Copy what you see in the assignment.”
“Well, you don’t care about spaces, right?”
“I care about spaces, too.”
“What about periods?”
“Those matter, as well.”
“You mean that everything has to be exactly the same?”
“Yes, that’s what I meant to say.”
“What do you mean by the very very very beginning of the file?”
“You’re just trying to get me to have a stroke.”
Follow the directions on the homework page.
Turn in someone else’s work.