Calculate sum of scores after N days based on given conditions | Function to calculate sum of scores after n days ; Store the number of full weeks ; Stores the remaining days in the last week ; Store the sum of scores in the first F full weeks ; Store the sum of scores in the last week ; Prlet the result ; Driver code
function findScoreSum ( n ) { let F = n / 7 ; let D = n % 7 ; let fullWeekScore = ( 49 + 7 * F ) * F / 2 ; let lastNonFullWeekScore = ( 2 * F + D + 1 ) * D / 2 ; document . write ( Math . floor ( fullWeekScore + lastNonFullWeekScore ) ) ; } let N = 8 ; findScoreSum ( N ) ;