Working with Negative Numbers in C#

To convert a negative number to a positive number, use the Abs function. Like this.
int myInt = System.Math.Abs(-5);
To convert a positive number to a negative number there is no built in function, but you can simply do this,
myInt = myInt * -1


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *