Perfect Cube String | C # program to find if String is a perfect cube or not . ; Finding ASCII values of each character and finding its sum ; Find the cube root of sum ; Check if sum is a perfect cube ; Driver code
using System ; class GFG { static bool isPerfectCubeString ( String str ) { int sum = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) sum += ( int ) str [ i ] ; double cr = Math . Round ( Math . Pow ( sum , ( double ) 1 / 3 ) ) ; return ( cr * cr * cr == sum ) ; } public static void Main ( String [ ] args ) { String str = " ll " ; if ( isPerfectCubeString ( str ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }