Mechanical Engineering Undergraduate

simple code

Write an interactive program to perform the following tasks in order:
a) Ask user to input an array size that is an integer value ranging from 10 to 20, inclusively
b) Check the validity of user input and ask the user to input again if previous value was invalid
c) Echo users valid input value on the screen
d) Assign array elements with random values (integer ranging from 0 to 100, inclusively)
e) Display array elements in their original order
f) Sort array elements from maximum to minimum
g) Display array elements in sorted order
h) Compute and display the median value of array elements
i) Compute and display the mean value of array elements
j) Compute and display the variance value of array elements
Your program needs to meet the following requirements:
Array elements are assigned with random values that do not repeat among executions
Array sorting is done in a sub-function
Computing median value is done in a sub-function
Computing mean value is done in a sub-function
Computing variance value is done in a sub-function

Note: as a common practice to check input validity when using scanf(), add a while loop right
after a call to scanf() to consume un-read characters (including the newline character n) in
the input buffer. See the following example for usage.

write it all in C language!

Leave a Reply

Your email address will not be published. Required fields are marked *