I need to write a program that shows the sign (+, - or 0) of the product (multiplication) of three (3) real numbers, without calculating it.

I must use a sequence of if operators.

Examples:

 a b c result 5 2 2 + -2 -2 1 + -2 4 3 - 0 -2.5 4 0 -1 -0.5 -5.1 -

+1 vote

Here is my solution. Although, a bit long...

```using System;

class MultiplicationSign
{
static void Main()
{

if ((a < 0 && b > 0 && c > 0) || (b < 0 && a > 0 && c > 0) || (c < 0 && a > 0 && b > 0) || (a < 0 && b < 0 && c < 0))
{
Console.WriteLine("-");
}
else if ((a < 0 && b < 0 && c > 0) || (a < 0 && c < 0 && b > 0) || (b < 0 && c < 0 && a > 0) || (a > 0 && b > 0 && c > 0))
{
Console.WriteLine("+");
}
else if (a == 0 || b == 0 || c == 0)
{
Console.WriteLine("0");
}
}
}```
edited by user golearnweb
+1 vote

Another result:

```if (a > 0 && b > 0 && c > 0)
{
Console.WriteLine("+");
}
else if (a < 0 && b < 0 && c < 0)
{
Console.WriteLine("-");
}
else if (a > 0 && b > 0 && c < 0)
{
Console.WriteLine("-");
}
else if (a > 0 && b < 0 && c > 0)
{
Console.WriteLine("-");
}
else if (a < 0 && b > 0 && c > 0)
{
Console.WriteLine("-");
}
else if (a > 0 && b < 0 && c < 0)
{
Console.WriteLine("+");
}
else if (a < 0 && b < 0 && c > 0)
{
Console.WriteLine("+");
}
else if (a < 0 && b > 0 && c < 0)
{
Console.WriteLine("+");
}
else
{
Console.WriteLine(0);
}```