Calculate money placed in boxes after N days based on given conditions | Function to find the total money placed in boxes after N days ; Stores the total money ; Iterate for N days ; Adding the Week number ; Adding previous amount + 1 ; Return the total amount ; Input ; Function call to find total money placed
function totalMoney ( N ) { let ans = 0 ; for ( let i = 0 ; i < N ; i ++ ) { ans += Math . floor ( i / 7 ) ; ans += ( i % 7 + 1 ) ; } return ans ; } let N = 15 ; document . write ( totalMoney ( N ) ) ;