Program to find value of 1 ^ k + 2 ^ k + 3 ^ k + ... + n ^ k | Function to find value of 1 ^ K + 2 ^ K + 3 ^ K + . . + N ^ K ; Initialise sum to 0 ; Find the value of pow ( i , 4 ) and then add it to the sum ; Return the sum ; Drivers Code ; Function call to find the sum
function findSum ( N , k ) { let sum = 0 ; for ( let i = 1 ; i <= N ; i ++ ) { sum += Math . pow ( i , k ) ; } return sum ; } let N = 8 , k = 4 ; document . write ( findSum ( N , k ) ) ;