C code Homework
EECE237 Spring 2016
Homework #2
1) Task
Write a C program in uVision that performs the function described below.
a) Begin with the assumption that 10 randomly selected variables of uint32_t type are stored in the array, numbers[10].
b) The program arranges these numbers in an ascending order from numbers[0] to numbers[9] in the same array. Numbers[0] has the smallest number, numbers[9] has the largest number in the array.
c) The algorithm of the program should be general enough to apply to any integer numbers in any order.
d) Once you have an idea for the algorithm, draw a flow chart first. Then write codes.
e) This is a coding exercise. You don't need to run the program.
2) Hints
a) Remember that C program can compare only two (2) numbers at a time.
b) First, find the smallest number out of 10 numbers and store it at numbers[0]. You did this in Homework 1 in assembly.
c) Then find the next smallest number from numbers[1] to [9]. Store it at numbers[1].
d) Repeat step c) moving numbers[1] to [2], [3] and so on, until it reaches numbers[8].
e) Hint: The program uses double looping.
3) Deliverables and due date
a) Submit your flow chart of the program. You may do the drawing either by using Microsoft Word, or do hand-drawing and scan.
b) Submit .c file.
c) Clearly write the class section number and your name in the first line of comment.
d) The homework is due by 11:59pm April 3rd, 2016 (Sun).