Program for weighted mean of natural numbers . | Returns weighted mean assuming for numbers { 1 , 2 , . . n } and weights { 1 , 2 , . . n } ; Driver Code
function weightedMean ( n ) { return parseInt ( ( 2 * n + 1 ) / 3 , 10 ) ; } let n = 10 ; document . write ( weightedMean ( n ) ) ;