Find the sequence number of a triangular number | C # code to print sequence number of a triangular number ; If N is not tringular number
using System ; class GFG { public static void Main ( ) { int N = 21 ; int A = ( int ) ( Math . Sqrt ( 2 * N + 0.25 ) - 0.5 ) ; int B = A ; if ( B != A ) Console . Write ( " - 1" ) ; else Console . Write ( B ) ; } }