Program to calculate expected increase in price P after N consecutive days | Function to find the increased value of P after N days ; Expected value of the number P after N day ; Driver code
function expectedValue ( P , a , b , N ) { var expValue = P + ( N * 0.5 * ( a + b ) ) ; return expValue ; } var P = 3000 var a = 20 var b = 10 var N = 30 document . write ( expectedValue ( P , a , b , N ) ) ;