Perfect Cube | C ++ program to check whether the given number N is the perfect cube or not ; Function to check if a number is a perfect Cube using inbuilt function ; If cube of cube_root is equals to N , then print Yes Else print No ; Driver 's code ; Function call to check N is cube or not
#include <bits/stdc++.h> NEW_LINE using namespace std ; void perfectCube ( int N ) { int cube_root ; cube_root = round ( cbrt ( N ) ) ; if ( cube_root * cube_root * cube_root == N ) { cout << " Yes " ; return ; } else { cout << " NO " ; return ; } } int main ( ) { int N = 125 ; perfectCube ( N ) ; return 0 ; }