For this assignment, you will write a C program called first.c.
This program reads two numbers from the user,
and produces a few arguably-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 first.c
% ./a.out
Enter numbers: 21 105
Your numbers are 21 and 105
21 divided by 105: 0.200000
Difference: 84
Both are divisible by seven.
% ./a.out
Enter numbers: 17 12
Your numbers are 17 and 12
17 divided by 12: 1.416667
Difference: 5
Neither is divisible by seven.
% ./a.out
Enter numbers: 14 -3
Your numbers are 14 and -3
14 divided by -3: -4.666667
Difference: 17
14 is divisible by seven, however, -3 isn't.
% ./a.out
Enter numbers: 4 7
Bad luck!
% ./a.out
Enter numbers: 60 0
Your numbers are 60 and 0
60 divided by zero: boom!
Difference: 60
60 isn't divisible by seven, but 0 is.
%
.c file; not the binary,
not the executable, not the a.out.
first.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?”
“Dear oh dear.”
Follow the directions on the homework page.
Turn in someone else’s work.