Code to fulfill negative values check requirement