Check if a number can be represented as sum of two consecutive perfect cubes | C # program to implement above approach ; Function to check that a number is the sum of cubes of 2 consecutive numbers or not ; Condition to check if a number is the sum of cubes of 2 consecutive numbers or not ; Driver Code ; Function call
using System ; class GFG { static bool isSumCube ( int N ) { int a = ( int ) Math . Pow ( N , ( double ) 1 / 3 ) ; int b = a - 1 ; return ( ( a * a * a + b * b * b ) == N ) ; } public static void Main ( String [ ] args ) { int i = 35 ; if ( isSumCube ( i ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }