Question: Exercise 1 - Statistics on array with random numbers Write a program in C which fills, with random values between 0 and M, a square

 Exercise 1 - Statistics on array with random numbers Write a

Exercise 1 - Statistics on array with random numbers Write a program in C which fills, with random values between 0 and M, a square matrix TNx Consider that M and N are constants. Then, your program should calculate and print the following: The number of occurrences of each number in the matrix r (frequencies of all the numbers) You will need a second 1D array with the name freq and size M 1. The mean value and the population standard deviation of all the elemnts in the matrix The mean value and the population standard deviation of a set of n numbers {X1, X2, . . . , Xn} are real numbers and they are defined as: 7n Try to calculate efficiently by transforming the Equation You will need the function sqrt which is defined in , and the function rand, which is defined in . Do not use any build-in functions that calculate the mean and the standard deviation values automatically. Exercise 2 - Random number generation Modify vour solution in Exercise 1, so as to ask from the user a maximum tolerable standard deviation maz. Your program should repeat the generation of the numbers for the array r until the standard deviation is smaller than omar or a number of maximum tries (e.g. 1000) has been reached. In the first case, your program should print all the elements of the array along with the standard deviation, while in the second case a message should inform the user that the maximum numbers of tries has been reached

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!