Your firmware needs to capture a burst of sensor readings. The number of readings (n) is not known at compile time, so a dynamic buffer must be allocated using new[].
Steps:
Read integer n — number of samples to store.
If n is less than 1, terminate the program.
Dynamically allocate an integer array of size n using new[].
Read n sensor readings into the buffer.
Compute the average sensor value using integer division.