Hello Dinesh, hello folks! > updated code to handle following patterns [Thanks for pointing out] > // (X > 0) ? X : -X > // (X < 0) ? -X : X > // (X > 1) ? -X : X The last line looks incorrect to me. I think it should be (X >= 1) ? -X : X and/or (X > 0) ? -X : X and/or (X >= 0) ? -X : X and/or (X > -1) ? -X : X Best regards Jasper