Check if N can be represented as sum of squares of two consecutive integers | C # implementation to check that a number is sum of squares of 2 consecutive numbers or not ; Function to check that the a number is sum of squares of 2 consecutive numbers or not ; Condition to check if the a number is sum of squares of 2 consecutive numbers or not ; Driver code ; Function call
using System ; class GFG { public static bool isSumSquare ( int N ) { double n = ( 2 + Math . Sqrt ( 8 * N - 4 ) ) / 2 ; return ( n - ( int ) n ) == 0 ; } public static void Main ( String [ ] args ) { int i = 13 ; if ( isSumSquare ( i ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }