lab08
by typing:
mkdir lab08Change to this directory by typing:
cd lab08
These revision exercises are not assessable.
They do not get marked.
There is no need to submit them with give.
Revision lab times will be announced which you can attend to get help with these revision exercises.
You may assume that the program's input will contain only integers and will contain at least 10 integers, in other words you can assume scanf succeeeds.
Match the the example below EXACTLY.
./read_ten 1 2 4 16 32 64 128 256 512 1024 Numbers were: 1 2 4 16 32 64 128 256 512 1024As usual autotest is available to help you test your program.
~cs1511/bin/autotest lab08 read_ten.c
Hint: use read_ten.c as a starting point.
You may assume that the program's input will contain only integers and will contain at least 10 integers, in other words you can assume scanf succeeeds.
Match the the example below EXACTLY.
./reverse_ten 1 2 4 16 32 64 128 256 512 1024 Numbers were: 1024 512 256 128 64 32 16 4 2 1As usual autotest is available to help you test your program.
~cs1511/bin/autotest lab08 reverse_ten.c
Hint: use read_ten.c as a starting point.
You may assume that the program's input will contain only positive integers and will contain at least 10 integers, in other words you can assume scanf succeeeds.
Match the the example below EXACTLY.
./odd_even_ten 1 2 4 16 32 64 128 256 512 1024 Odd numbers were: 1 Even numbers were: 2 4 16 32 64 128 256 512 1024 ./odd_even_ten 3 5 7 11 13 11 9 7 5 3 Odd numbers were: 3 5 7 11 13 11 9 7 5 3 Even numbers were:As usual autotest is available to help you test your program.
~cs1511/bin/autotest lab08 odd_even_ten.c
Hint: use odd_even_ten.c as a starting point.
You may assume that the program's input will contain only integers, in other words you can assume scanf succeeeds.
You can assume a negative integer will always be read.
You can assume at most 1000 integers are read before a negative integer is read.
Match the the example below EXACTLY.
./odd_even_negative 1 2 3 2 -42 Odd numbers were: 1 3 Even numbers were: 2 2 ./odd_even_negative 1 2 4 16 32 64 128 256 512 1024 2048 4096 -8192 Odd numbers were: 1 Even numbers were: 2 4 16 32 64 128 256 512 1024 2048 4096As usual autotest is available to help you test your program.
~cs1511/bin/autotest lab08 odd_even_negative.c
It should then print the odd numbers on one line then print the even numbers on one line.
Hint: use odd_even_negative.c as a starting point.
You may assume that the program's input will contain only integers.
You can assume at most 1000 integers will be read before end-of-input is reached.
Match the the example below EXACTLY.
./odd_even_eof 1 2 4 16 32 64 128 256 512 1024 2048 4096 Odd numbers were: 1 Even numbers were: 2 4 16 32 64 128 256 512 1024 2048 4096 ./odd_even_eof 3 -3 4 -4 4 Odd numbers were: 3 -3 Even numbers were: 4 -4 4As usual autotest is available to help you test your program.
~cs1511/bin/autotest lab08 odd_even_eof.c
Hint: use odd_even_eof.c as a starting point.
You may assume that the program's command line arguments will only be integers.
You can assume at most 1000 command line arguments will be supplied.
Match the the example below EXACTLY.
./odd_even_argument 1 2 4 16 32 64 128 256 512 1024 2048 4096 Odd numbers were: 1 Even numbers were: 2 4 16 32 64 128 256 512 1024 2048 4096 ./odd_even_argument 3 -3 4 -4 4 Odd numbers were: 3 -3 Even numbers were: 4 -4 4As usual autotest is available to help you test your program.
~cs1511/bin/autotest lab08 odd_even_argument.c
It should then print the integers read which are not exactly divisible by any other of the integers read.
In other words it should not print an integer if another integer that has been read is a factor of that number.
Hint: use odd_even_eof.c as a starting point.
You may assume that the program's input will contain only integers.
You may assume that all integers are > 1.
You can assume at most 1000 integers will be read before end-of-input is reached.
Match the the example below EXACTLY.
./indivisible 42 7 6 12 Indivisible numbers: 7 6 ./indivisible 2 3 4 5 6 7 8 9 10 Indivisible numbers: 2 3 5 7 ./indivisible 5 6 5 Indivisible numbers: 6As usual autotest is available to help you test your program.
~cs1511/bin/autotest lab08 indivisible.c
They do not get marked.
There is no need to submit them with give.