For this assignment, you will write a C program called ints.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. The “%
” is the command
prompt, text like this is typed by the user, and the rest is from
the program. (You don’t have to make it colored or 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):
                
% c11 -Wall ints.c % ./a.out Two numbers, please: 123456 7 Dividing 123456/7: 17636.571429 Pos diff: 123449 Divisible: only 123456 % ./a.out Two numbers, please: 1 2 Dividing 1/2: 0.500000 Pos diff: 1 Divisible: neither % ./a.out Two numbers, please: 5 -18 Dividing 5/-18: -0.277778 Pos diff: 23 Divisible: only -18 % ./a.out Two numbers, please: 0 42 Dividing 0/42: 0.000000 Pos diff: 42 It's the answer! Divisible: both % ./a.out Two numbers, please: 0 0 Dividing 0/0: against the rules. Pos diff: 0 Divisible: both % ./a.out Two numbers, please: 5 0 Dividing 5/0: against the rules. Pos diff: 5 Divisible: only 0 % ./a.out Two numbers, please: -3 3 Dividing -3/3: -1.000000 Pos diff: 6 Divisible: neither
.c
file; not the binary,
not the executable, not the a.out
.
Use                 
~cs156/bin/checkin HW1 ints.c
or web checkin.                 
Turn in someone else’s work.                 
Modified: 2017-08-26T16:40                  User: Guest                  Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |
![]() |