Perfect Cube | Function to check if a number is a perfect Cube or not ; Iterate from 1 - N ; Find the cube of every number ; Check if cube equals N or not ; Driver code ; Function call
function perfectCube ( N ) { let cube ; for ( let i = 0 ; i <= N ; i ++ ) { cube = i * i * i ; if ( cube === N ) { document . write ( " " ) ; return ; } else if ( cube > N ) { document . write ( " " ) ; return ; } } } let N = 216 ; perfectCube ( N ) ;