using System;
class Sample
{
public static void Main()
{
byte xByte1 = 0;
short xShort1 = -2;
int xInt1 = -3;
long xLong1 = -4;
float xSingle1 = 0.0f;
double xDouble1 = 6.0;
Decimal xDecimal1 = -7m;
sbyte xSbyte1 = -101;
Console.WriteLine(Test(Math.Sign(xByte1)));
Console.WriteLine(Test(Math.Sign(xShort1)));
Console.WriteLine(Test(Math.Sign(xInt1)));
Console.WriteLine(Test(Math.Sign(xLong1)));
Console.WriteLine(Test(Math.Sign(xSingle1)));
Console.WriteLine(Test(Math.Sign(xDouble1)));
Console.WriteLine(Test(Math.Sign(xDecimal1)));
Console.WriteLine(Test(Math.Sign(xSbyte1)));
}
public static String Test(int compare)
{
if (compare == 0)
return "equal to";
else if (compare < 0)
return "less than";
else
return "greater than";
}
}
|