HW2- In this part, do the following task: (1) Write a C program that computes th
ID: 2267670 • Letter: H
Question
HW2- In this part, do the following task: (1) Write a C program that computes the median of a 100 element integer array. The integers in the array will range from-999 to 999. The array may be modified by your program, but the result computed by your progra be actual, not a statistical approximation. The result is an integer. For an even number of elements N, the median is the mean of the two elements for which (N-2)/2 elements of the array are greater and (N-2)/2 elements of the array are less than. This mean is computed by integer division (round towards 0) m should be the median of the original array. The result should sly defined 100 element vector stored in a file. A shell Your program works with a program is provided to help you get started. The included printf statement should be used to print your result so it can be properly graded. Its output format should not be modified. While there are many median code examples available (e.g., on the web), you should design, implement, and test your own code. Otherwise you won't learn the things you need to know for later assignments and exams. Any submitted project containing code not fully created and debugged by the student constitutes academic misconduct The shell program HW2-1-shell.c includes a reader function Load Mem that loads the values from a text file. You should use gcc on the command line to develop your program. Sample value files (test-12.txt, test41.txt, test55.txt, test62.txt, test118.txt) are provided on the project website. You should compile and run your program using the Unix/Linux command lines: gcc HW2-1.c-g-Wal1o HW2-1 >/HW2-1 test215.txt In this example, the input test case is the value file test215.txt. In order for your solution to be properly received and graded, there are a few requirements. 1. The file must be named HW2-1.c 2. You name and the date should be included in the header comment. 3. The starting shell program should not be modified except for the replacement of the comment/your program goes here /and the addition and/or initialization of declared local variables. It is especially important not to remove or modify the print statement since that will be used in the automatic grading process. 4. As in HW1, you may not use any external functions in your program.Explanation / Answer
int temp; for (int i = 1 ; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.