This is a most commonly used program to find the RMS or  Root Mean Square Value. Today we will implement it using C++ so let's start.


The RMS value  is the  square root  of the  mean  (average)  value  of the  squared  function of the instantaneous  values . Means RMS method first calculates the square of each number and then calculate the mean and finally calculate the square root of the mean.

We will do the same using rmsValue() function .

 // Calculate square value . 
    for (int i = 0; i < n; i++) { 
        square += pow(arr[i], 2); 
    // Calculate Mean value . 
    mean = (square / (float)(n)); 
    // Calculate Root value. 
    rootValue = sqrt(mean);

Sample Output


That's it , I hope it's may help you. let me know in the comment box.