You must time the test yourself and ensure you comply with the conditions below.
Write a C program count_up.c
that reads 2 positive integers and prints the integers between them, one per line.
Your program should behave exactly like these examples:
dcc count_up.c -o count_up ./count_up Enter lower: 4 Enter upper: 8 5 6 7 ./count_up Enter lower: 9 Enter upper: 15 10 11 12 13 14 ./count_up Enter lower: 42 Enter upper: 43
You can assume the user supplies 2 positive integers.
You can assume the first integer is smaller than the second.
You do not have do any error checking.
You do not have to check the return value from scanf.
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest count_up
give cs1511 test05_count_up count_up.c
Write a C program product_odd.c
that reads 2 positive integers and calculates the product of the odd integers between the first and second integers.
For example, if the two integers entered are 10 and 16 then 2145 should be printed
because 11 * 13 * 15 = 2145
.
If there are no odd integers between the first and second integers, your program should print 1.
Your program should behave exactly like these examples:
dcc product_odd.c -o product_odd ./product_odd Enter lower: 10 Enter upper: 16 2145 ./product_odd Enter lower: 4 Enter upper: 8 35 ./product_odd Enter lower: 5 Enter upper: 7 1 ./product_odd Enter lower: 5 Enter upper: 9 7
You can assume the user supplies 2 positive integers.
You can assume the first integer is smaller than the second.
You can assume that the product will fit in an ''int''. In other words you can assume overflow does not occur.
You do not have do any error checking.
You do not have to check the return value from scanf.
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest product_odd
give cs1511 test05_product_odd product_odd.c
Write a program called prime_factors.c that reads a integer n from standard input and prints the decomposition of n into prime factors.
If n is prime it should instead print "n is prime" (where n is the integer).
Make your program match the examples below exactly.
./prime_factors Enter number: 6 The prime factorization of 6 is: 2 * 3 = 6 ./prime_factors Enter number: 30 The prime factorization of 30 is: 2 * 3 * 5 = 30 ./prime_factors Enter number: 127 127 is prime ./prime_factors Enter number: 2048 The prime factorization of 2048 is: 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 = 2048 ./prime_factors Enter number: 22500 The prime factorization of 22500 is: 2 * 2 * 3 * 3 * 5 * 5 * 5 * 5 = 22500 ./prime_factors Enter number: 22501 22501 is prime
You can assume the user supplies an integer n > 2.
You do not have do any error checking
You do not have to check the return value from scanf.
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest prime_factors
give cs1511 test05_prime_factors prime_factors.c
You can run give multiple times. Only your last submission will be marked.
Don't submit any exercises you haven't attempted.
If you are working at home, you may find it more convenient to upload your work via give's web interface.
Remember you have until Thursday 12 April 23:59:59 to complete this test.
Automarking will be run several days after the submission deadline for the test. When complete you can view automarking here and you can view the the resulting mark via give's web interface