Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

Students also viewed these Databases questions

Question

=+Trainers from headquarters? Local trainers? Independent trainers?

Answered: 1 week ago