Concentration of juice after mixing n glasses in equal proportion | C ++ implementation of the approach ; Function to return the concentration of the resultant mixture ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; double mixtureConcentration ( int n , int p [ ] ) { double res = 0 ; for ( int i = 0 ; i < n ; i ++ ) res += p [ i ] ; res /= n ; return res ; } int main ( ) { int arr [ ] = { 0 , 20 , 20 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << mixtureConcentration ( n , arr ) ; }