Hi,
How can I make an integer negative in C#?
abc = 5645307;
// how to make abc -5645307 ?
Hi,
How can I make an integer negative in C#?
abc = 5645307;
// how to make abc -5645307 ?
Maybe I'm missing something:
abc = -abc;
If you want it to be negative whether it was negative beforehand or not, you would use:
abc = -Math.Abs(abc);
This is how you can convert your int value to minus in c#
abc = abc > 0 ? abc*(-1) : abc;