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
Working with Negative Numbers in C#
by
Tags:
Leave a Reply