How do I check if a number is positive or negative in C#?
Of course no-one's actually given the correct answer,
num != 0 // num is positive *or* negative!
bool positive = number > 0;
bool negative = number < 0;
Of course no-one's actually given the correct answer,
num != 0 // num is positive *or* negative!
bool positive = number > 0;
bool negative = number < 0;