Challenge 3: Calculate Mean and Standard Deviation from Array

In this lesson, we will practice allocating and manipulating dynamic memory.

We'll cover the following

Problem statement

In this challenge, you have to perform the following tasks:

  • Use a pointer to allocate a dynamic array of size 10.

  • Initialize this array with random numbers between 0 and 99.

  • Then, calculate the mean and standard deviation of these numbers and print them.

  • Finally, deallocate the memory used by the array.

Note: You can use the rand() method to generate random numbers.

Coding exercise

Implement the solution in the code playground given below. After solving, check next lesson and compare your solution.