How to

get sign for number

Published: 14. October 2011 | Updated: 14. October 2011
License: Microsoft Public License (MS-PL)
Categories: Framework » Math
Tags: C# Math
Was this snippet helpful for you? YESYES / NONO
int sign = Math.Sign(16795);
Console.WriteLine(sign);

sign = Math.Sign(-4579);
Console.WriteLine(sign);

sign = Math.Sign(0);
Console.WriteLine(sign);
Console Output:
1
-1
0
Send us feedback about this snippet »



Related Snippets: